Skip to content

Instantly share code, notes, and snippets.

@vyuh
Created January 4, 2018 19:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vyuh/321db24e5208c1781dc858026df2f136 to your computer and use it in GitHub Desktop.
Save vyuh/321db24e5208c1781dc858026df2f136 to your computer and use it in GitHub Desktop.
A nice plain tex macro for tryin control sequences in math mode.
\magnification=1200
\def\endmathwords{$$}
\def\trymathwords#1{%
$$
\begingroup
\edef\@tempa{#1\space}%
\expandafter\endgroup
\expandafter\readwords\@tempa\relax
}
\def\readwords#1 #2\relax{%
\doword{#1}% #1 = substr, #2 = rest of string
\begingroup
\ifx\relax#2\relax % is #2 empty?
\def\next{\endgroup\endmathwords}% your own end-macro if required
\else
\def\next{\endgroup\readwords#2\relax}%
\fi
\next
}
\def\doword#1{\csname#1\endcsname\quad}
\trymathwords{
alpha beta gamma
delta epsilon varepsilon
zeta eta theta
vartheta pi rho
varrho sigma varsigma
tau upsilon phi
varphi chi psi
omega
}
\trymathwords{
aleph prime
hbar emptyset
forall exists
imath jmath
nabla neg
surd
ell wp
top bot
}
\trymathwords{
flat natural sharp
Re Im partial infty
| angle triangle backslash
clubsuit diamondsuit heartsuit spadesuit
}
\bye
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment