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

1 Answer 1

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, 2020 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, 2020 at 16:52
  • You are right but that didn't actually solve the problem. Preview-latex still ignores the newcommands.
    – fakedrake
    Jun 3, 2020 at 11:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .