Skip to content

Instantly share code, notes, and snippets.

View FriendsAtDawn's full-sized avatar
🦍
The Stars Are Falling

Stand Your Gists FriendsAtDawn

🦍
The Stars Are Falling
View GitHub Profile
@FriendsAtDawn
FriendsAtDawn / dynamic-object-definition-latex-useful-trick.md
Last active December 5, 2025 13:06
How to use number in latex arguments \command{#}

Dynamic Object Definition in LaTeX: Define and Call Objects with Custom Commands

Description

Tired of manually defining dozens of similar LaTeX commands for objects like chair1, chair2, etc.? This macro lets you dynamically create and manage object families (e.g., chairs, tables, equations) with long and short names, all while keeping your code clean and scalable.

  • Define once: \InitNuevoObjeto{chair} creates \defineChair{key}{long}{short}.
  • Use anywhere: Call \chair{1} for the long name or \chair{1!} for the short version.
  • No limits: Works for any object type (e.g., \InitNuevoObjeto{table}, \InitNuevoObjeto{equation}).
@FriendsAtDawn
FriendsAtDawn / keybase.md
Last active September 16, 2025 15:22
keybase

Keybase proof

I hereby claim:

  • I am friendsatdawn on github.
  • I am wils0n (https://keybase.io/wils0n) on keybase.
  • I have a public key ASDUHsMMyECsWcJPyfR4VIsCpX1OWUvO0Rg7lqtV_nonIQo

To claim this, I am signing this object:

@FriendsAtDawn
FriendsAtDawn / numbers-to-word-latex.md
Last active October 7, 2023 01:08
Numbers to spelling-words

I have previously attempted this with Lua, but was unsuccessful. I barely know how to do scripts. This is not one, it's just a little trick for newbies.

  1. Install num2words from Python.

  2. Load the shellesc package in LaTeX.

  3. Run the program, e.g. pdflatex with the --shell-escape flag. Example: pdflatex --shell-escape [other flags] "main".tex. Without it, LaTeX is not granted access to shell.

  4. Write something like this in the preamble:\newcommand{\nWords}[1]{\ShellEscape{num2words #1 -l is > #1.aux} \input{#1.aux}}. This produces a file nWords.aux in the main directory, you can delete it when delete all the aux files. I know there are other ways I left to your skills.

@FriendsAtDawn
FriendsAtDawn / Números-a-letras.md
Last active August 1, 2023 22:16
Truco para novatos que quieren escribir montos en LaTex.

Numeros a letras en LaTex

He intentado antes con Lua, sin exito. No se hacer scripts. Este no es uno, es apenas un pequeño desvío para novatos.

Se necesita:

  1. Instalar num2words de Phyton.
  2. Cargar el paquete shellesc en LaTex.
  3. Correr el programa, digamos, pdflatex con el flag --shell-escape. Ejemplo: pdflatex --shell-escape [otros flags] "main".tex. Sin ello, LaTeX no tiene permiso.
  4. Escribir en el preambulo algo como: \newcommand{\letras}[1]{\ShellEscape{num2words #1 -l es > #1.aux} \input{#1.aux}}.