josephwright wrote:Sorry, my error in the definition above. TryYue wrote:This works, but when I use \en{\textbf{k}}, it gives me two \epsilons. Is there no easy way to do \en{\textbf{k}} and \en?josephwright wrote:Code: Select all
\documentclass{article} \usepackage{xparse} \NewDocumentCommand\en{g}{% \IfNoValueTF#1{\epsilon}{\epsilon_{#1}}% } \begin{document} See \( \en \) but \( \en{a} \)! \end{document}
(Note the braces around #1 after \IfNoValueTF: I forgot those!)Code: Select all
\documentclass{article} \usepackage{xparse} \NewDocumentCommand\en{g}{% \IfNoValueTF{#1}{\epsilon}{\epsilon_{#1}}% } \begin{document} See \( \en \) but \( \en{\textbf{k}} \)! \end{document}
Works great! Thanks! I replayed \epsilon with \en 45 times ^^, I hope this wont cause me problems, because then I can't change it back. I mean, this package and command wont cause trouble?