I have been searching a bit for a trouble I am having and can't find any answers applicable to my problems.

So I have made a short little macro/typesetting command for easily writing out terms and explanations of said terms in a nice way for a document I am working on. And while at first a couple of them worked flawlessly it suddenly wouldn't compile after adding a new instance of the command.

So here is an example (have verified that this second addition of the \term command to be producing the error).


\newcommand{\term}[3]{\raggedright\textbf{#1} - #2.\\ \def\temp{#3} \ifx\temp\empty \else \begin{adjustwidth}{18pt}{0pt} #3 \end{adjustwidth}\fi}


\term{P/FCF}{Price per Free Cash Flow}
\term{P/OP}{Price per Operative cash flow }


Okay, and so my biggest issue with this all is inconsistency. The code compiles if you enter a line break between the two \term commands. However it does not seem to be a problem between all instances of the \term command. (In my original text I had 8-9 terms following each other, and suddenly when I entered this P/OP term it does not compile?)

Like try entering a few \term{asdf}{asdf} in subsequence, it has no problems. But using this second term it somehow breaks the function of the command.

Have no clue if you need any other info, am trying to compile this in TeXStudio on a TeX Live distribution. Thankful for any clues

  • 1
    \term is defined as macro with three arguments, but it is used with two of them. Feb 25 '17 at 19:39
  • or rather, the third argument for the first \term is the second \term so you are running \begin{adjustwidth}{18pt}{0pt} \term \end{adjustwidth} and the first two argumento 0f that \term are \end and adjustwidth. Feb 25 '17 at 19:42
  • I confirm Heiko's above comment. The OP code fails, but works with an inserted line break. SOLUTION: Add {} after the two as-written \term arguments, to absorb the missing third argument. Or, re-write \term. Also see what David wrote.
    – user103221
    Feb 25 '17 at 19:42
  • lol, this is too late brain fart from my side obviously. that is indeed why it worked smoothly before, I can't believe I missed that... I mean the I've written it all myself. I have to go get some rest I think... Thanks for pointing it out guys Feb 25 '17 at 19:44
  • How do I treat this? Give an empty answer to it? Whats the proper way to go about having posted a way stupid question? Feb 25 '17 at 19:45

In my tiredness I missed to use empty brackets for an optional third argument to my \term macro. Very swiftly pointed out in the comments. Thanks guys.

  • Or well I guess in all correctness the argument isn't really optional, but rather conditional that it will be treated differently if it is empty. Feb 25 '17 at 20:03

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.