texprintf(1.1.0)
π NAME π
texprintf, stexprintf, ftexprintf, texlistsymbols, texboxtree β extended formatted output functions β¨
Okay so hi bestie π«Ά this is the manual for texprintf, version 1.1.0, and she is literally the printf family's cooler older sister who went to math camp and came back with LaTeX energy. Let's get into it π
β¨ SYNOPSIS β¨
#include <texprintf.h>
int texprintf(const char *format, ...);
char * stexprintf(const char *format, ...);
int ftexprintf(const char *format, ...);
void texlistsymbols();
void texboxtree(const char *format, ...);
void texlistsymbols();
void texerrors();
Not me pointing out that texlistsymbols() shows up twice in that list β yeah, that's genuinely how it's written, we're keeping it exactly as-is, no cap π
On top of all those functions, <texprintf.h> also defines a couple of variables for you, and ngl they're kind of the main characters of this whole page:
int TEXPRINTF_LW;
char * TEXPRINTF_FONT;
int TEXPRINTF_ERR;
πΈ DESCRIPTION πΈ
So the whole texprintf family does formatted output β literally like the printf family you already know and love β except it's been extended with a tex-like syntax so you can write fancy math symbols in your terminal. The functions generate UTF-8 encoded strings, and they assume you're using monospace fonts. And yes, that goes for the symbols too β beware of non-monospace fallback fonts, they will absolutely ruin the vibe and misalign everything π
For all the deets on the tex-like syntax these functions give you, go read the utftex man page. And for a description of the format itself, go read the man page of printf. We're not re-explaining those here, bestie, that's their job π
π Return values, let's talk π
- On a successful return,
texprintfandftexprintfgive you back the number of characters printed β and that count does not include the null byte used to end output to strings. stexprintfis the generous one: it returns an allocated string containing the result. She said "here's your whole thing, take it" π
π TEXPRINTF_LW β the line-width queen π
This is an integer, and it lets you limit the line width.
- By default the line width is not limited at all β that's
TEXPRINTF_LW=0. - If you set
TEXPRINTF_LWto a positive integer, the texprintf functions will try to limit the line width to that number of characters, i.e. they try to break up the equation over more than one line. - To do that, the texprintf engine has to find suitable places to break the equation.
β οΈ But here's the tea: it is not guaranteed that a suitable location is found. So the line width is not guaranteed. It's giving "we'll try our best" energy, not "we promise" energy π
π¦ TEXPRINTF_FONT β pick your font, pick your era π¦
This string lets you specify the default font. The available fonts are:
mathsfbfitmathsfbfmathfrakmathbfitmathsfitmathcalmathscrmathbfmathbbmathsfmathttmathnormaltext(this one is the default π)
β TEXPRINTF_ERR β the error flag β
This is an integer, and it's an error flag.
- If its value is non zero after a call to any of the texprintf functions, then an error has occurred while parsing the input.
- A call to
texerrors()will print the corresponding error messages for you. So like, always check her, bestie π«Ά
π The other functions π
texlistsymbols()β prints all the symbols the texprintf system knows. Every single one. She's thorough like that β¨texboxtree(const char *format, ...)β this one is for debugging purposes. It takes the same arguments astexprintf, but instead of printing the nice pretty result, its output is a description of the resulting internal box datastructures. So it's the backstage-pass function, the "show me the wiring" function, iykyk π₯
π SEE ALSO π
And that's the whole page, bestie, you ate it π
This was texprintf version 1.1.0, dated 05 Jul 2022 β so yes, she's a lil vintage, and honestly? Vintage is a flex ππ Go forth and typeset your little heart out, mwah π«Άβ¨
π¦ where this page comes from
- fedora 43: libtexprintf 1.25-6.fc43 Β· GPL-3.0-only
- fedora 43: libtexprintf 1.25-6.fc43 Β· GPL-3.0-only
- fedora 44: libtexprintf 1.25-7.fc44 Β· GPL-3.0-only
- fedora 44: libtexprintf 1.25-7.fc44 Β· GPL-3.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms