texprintf(1.1.0)

πŸ“¦ version 1.25, in fedora 43, fedora 44

πŸ’– 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, texprintf and ftexprintf give you back the number of characters printed β€” and that count does not include the null byte used to end output to strings.
  • stexprintf is 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_LW to 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:

  • mathsfbfit
  • mathsfbf
  • mathfrak
  • mathbfit
  • mathsfit
  • mathcal
  • mathscr
  • mathbf
  • mathbb
  • mathsf
  • mathtt
  • mathnormal
  • text (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 as texprintf, 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