1

I have slightly complex symbols that I do not want to re-type in latex so I define \newcommands that abbreviate them. For example

\begin{document}
blah blah

\newcommand{\ds}[1]{\Delta\{#1\}}

\[
  \{x\} := \ds{a} + \ds{b_1} + \ds{c}
\]

blah blah
\end{document}

But when using preview-latex the \ds command is not recognized. Is there a way around this?

I am using auctex 12.3, emacs 26.3 and pdfTeX 3.14159265-2.6-1.40.21 (TeX Live 2020).

EDIT: It was pointed out that \newcommand{ds}{...} should be \newcommand{\ds}{...}. I edited the post to add the \ because that was a valid correction but it didn't solve the problem.

0
2

The syntax of \newcommand requires a backslash for the command to be defined: so not \newcommand{ds}{...}, but \newcommand{\ds}{...}

\begin{document}
  blah blah
 \newcommand{\ds}[1]{\Delta\{#1\}}
  %%         ^^^
 \[
 \{x\} := \ds{a} + \ds{b_1} + \ds{c}
 \]

 blah blah
 \end{document}
3
  • 3
    While the answer is essentially correct, some more words would be better, also avoiding to litter the code with something that inexperienced users might want to imitate.
    – egreg
    Jun 1 '20 at 15:08
  • @egreg sorry, i just wanted to highlight the faulty command. Fortunately there are good reviewers on tex.se. Thank you.
    – gigiair
    Jun 1 '20 at 16:52
  • You are right but that didn't actually solve the problem. Preview-latex still ignores the newcommands.
    – fakedrake
    Jun 3 '20 at 11:27

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.