1

When I delete the second \item, it compiles fine. However, with the second \item, I get ERROR: Missing $ inserted and the math renders incorrectly:

\documentclass[12pt]{article}

\newcommand \frob[2] {\langle #1,#2 \rangle_F}

\begin{document}
\begin{itemize}

\item What I want: $ 
\langle A,B \rangle_F 
\geq 
\langle C,D \rangle_F
$. 

\item What I get: $ 
\frob{A,B} 
\geq 
\frob{A,B} 
$.

\end{itemize}
\end{document}

the issue

Would appreciate any help with this issue!

  • Don't use \frob as \frob{A,B} but use it as \frob{A}{B}. Your \frob-macro does process two arguments which are not comma-separated. As result it delivers something where the phrases delivered via the arguments will be comma-separated. Maybe this confused you. ;-) If you do \frob{A,B}\geq, \frob's first undelimited argument will be formed from {A,B} and \frob's second undelimited argument will be formed from \geq. So all in all \frob{A,B} \geq \frob{A,B} should be \frob{A}{B}\geq\frob{C}{D} . – Ulrich Diez Feb 2 at 1:45
2

You defined \frob to take two arguments

\newcommand{\frob}[2]

However, you're only passing it one argument when you use it like this

\frob{A,B}

That's because arguments are specified as tokens or using braces {...}, not a comma-separated list of elements.

Since you're printing the same thing as you're passing, the following might be simpler:

enter image description here

\documentclass{article}

\newcommand{\frob}[1]{\langle #1 \rangle_F}

\begin{document}

\begin{itemize}
  \item
    What I want: $ 
    \langle A,B \rangle_F 
    \geq 
    \langle C,D \rangle_F
    $. 

  \item 
    What I get: $ 
    \frob{A,B} 
    \geq 
    \frob{A,B} 
    $.
\end{itemize}

\end{document}

If you really want to pass two arguments, then your definition should be

\newcommand{\frob}[2]{\langle #1, #2 \rangle_F}

and you'll use it via \frob{A}{B}.

  • Ah, obviously! I've used \frac that way, but somehow had a brain fart when defining my own function. Thanks! – Elliot Gorokhovsky Feb 2 at 22:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.