-3

I cannot get this work (please see the code below):It gives an error"undefined control sequence\xx at the line before \end{document}. What's wrong? I use pdflatex of MikTex under Windows10. It perfectly compiles a bare "Hello world file", so it is installed correctly. %motivation for the code below:I am a teacher and I need a macro to "correct"errors in my students' papers, as a teacher does in primary school with a red pen, i.e as Word does with its "Track changes feature" :The macro should show the "old text"and the "new" corrected text:th Old text should be strikethrough(later I will make it red), the new textshould be hug;eBelow they are denoted as Arg1 and Arg 2.

The question is NOT about how to configure miktex or how to use strikethrough or colors --- it is about why is the command \xx still undefined, i.e. why does not \newcommand work**:.? log file says:


! Undefined control sequence. l.9 \xx {first}{second}

EDIT:\xvs.\xx is corrected thanks to @David "\HUGE" command is corrected" thanks to @rafaele, still same error


%LaTeX code:

`\documentclass{article}
\usepackage{soul}
\newcommand{\x}[2]{ARG1:(\st{#1})ARG2: ({\Huge #2})}

\begin{document}


test:
\xx{first}{second}
\end{document}`
5
  • 3
    You define \x but use \xx. Commented Mar 24, 2022 at 0:18
  • 4
    you defined \x and used \xx Commented Mar 24, 2022 at 0:18
  • 2
    Use \Huge #2 or \huge #2. Commented Mar 24, 2022 at 0:23
  • @RaffaeleSantoro Thank you! I've changed the commandsto \Huge, still same result: undefined control sequence at line 9.:.log file says! Undefined control sequence. l.9 \xx {first}{second} Commented Mar 24, 2022 at 0:49
  • @DavidCarlisle Yes changing to \newcommand{\xx} has solved the problemThank you very much!!!Could you please convert your comment to answer? for me to accept it? Oh, so stupid of me! Shame on me! Should I now close the question?, or leave it as answered? Commented Mar 24, 2022 at 1:12

2 Answers 2

2

Just a typo in your LaTeX program..

Modify it as follows..

\documentclass{article}
\usepackage{soul}
\newcommand{\xx}[2]{ARG1:(\st{#1})ARG2: ({\Huge #2})}

\begin{document}


test:
\xx{first}{second}
\end{document}

It works - I tested!

LaTeX Output

1

If you do

\newcommand{\x}[2]{<whatever>}

you're defining \x, aren't you? So, why would you expect that \xx gets defined?

After your

\newcommand{\x}[2]{ARG1:(\st{#1})ARG2: ({\Huge #2})}

the call

\x{first}{second}

will do as requested, but of course \xx will raise the Undefined control sequence error.

The LaTeX kernel has

\newcommand{\setlength}[2]{<something irrelevant for the topic here>}

and you call it as

\setlength{\mylen}{12cm}

not \setlengthsetlength{\mylen}{12cm}.

You must log in to answer this question.

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