LaTeX forum ⇒ AUCTeX\RenewCommandCopy raises "Undefined control sequence" error

Information and discussion about AUCTeX, an integrated LaTeX environment based on GNU Emacs and XEmacs
newbie9999
Posts: 3
Joined: Sun Aug 13, 2023 1:51 pm

\RenewCommandCopy raises "Undefined control sequence" error

Postby newbie9999 » Sun Aug 13, 2023 2:15 pm

Hello,

To avoid conflict between siunitx and physics packages, I followed the recommendation and therefore used the command :
\RenewCommandCopy{\qty}{\SI}

Everything works fine on overleaf but my auctex version (13.2.1) raises an "Undefined control sequence" error associated to this command.

Here's a minimal example with what I would like to have:
- a "main.tex" file with :
------------------------------------------------
\documentclass[english]{my_article}

\begin{document}

\lipsum

\end{document}
------------------------------------------------

- a "my_article.cls" file:
------------------------------------------------
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{my_article}[2023/08/04 Classe personnelle, V1]

\LoadClass{scrartcl}

\RequirePackage[utf8]{inputenc}
\RequirePackage[TS1,T1]{fontenc}
\RequirePackage{lipsum}

\RequirePackage{siunitx}

\AtBeginDocument{
\RequirePackage{physics}
\RenewCommandCopy{\qty}{\SI}
}
------------------------------------------------

Would you have an idea of what is wrong?
Thank you very much for your help.

Recommended reading 2021:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics
rais
Posts: 412
Joined: Sun Nov 16, 2014 8:51 pm

\RenewCommandCopy raises "Undefined control sequence" error

Postby rais » Sun Aug 13, 2023 11:12 pm

I couldn't say without having a look at your .log file (from the failed attempt).

KR
Rainer

newbie9999
Posts: 3
Joined: Sun Aug 13, 2023 1:51 pm

\RenewCommandCopy raises "Undefined control sequence" error

Postby newbie9999 » Mon Aug 14, 2023 12:11 pm

Sorry, here is my .log file.
Thank you!
------------------------------------
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=pdflatex 2023.6.2) 14 AUG 2023 12:07
entering extended mode
restricted \write18 enabled.
file:line:error style messages enabled.
%&-line parsing enabled.
**main_test.tex
(./main_test.tex
LaTeX2e <2020-02-02> patch level 2
L3 programming layer <2020-02-14> (./article_test.cls
Document Class: article_test 2023/08/04 Classe personnelle, V1
(/usr/share/texlive/texmf-dist/tex/latex/koma-script/scrartcl.cls
Document Class: scrartcl 2020/01/24 v3.29 KOMA-Script document class (article)
(/usr/share/texlive/texmf-dist/tex/latex/koma-script/scrkbase.sty
Package: scrkbase 2020/01/24 v3.29 KOMA-Script package (KOMA-Script-dependent b
asics and keyval usage)

(/usr/share/texlive/texmf-dist/tex/latex/koma-script/scrbase.sty
Package: scrbase 2020/01/24 v3.29 KOMA-Script package (KOMA-Script-independent
basics and keyval usage)

(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks14
)
(/usr/share/texlive/texmf-dist/tex/latex/koma-script/scrlfile.sty
Package: scrlfile 2020/01/24 v3.29 KOMA-Script package (loading files)
)))
(/usr/share/texlive/texmf-dist/tex/latex/koma-script/tocbasic.sty
Package: tocbasic 2020/01/24 v3.29 KOMA-Script package (handling toc-files)
\scr@dte@tocline@numberwidth=\skip47
\scr@dte@tocline@numbox=\box45
)
Package tocbasic Info: omitting babel extension for `toc'
(tocbasic) because of feature `nobabel' available
(tocbasic) for `toc' on input line 137.
Class scrartcl Info: File `scrsize11pt.clo' used instead of
(scrartcl) file `scrsize11.clo' to setup font sizes on input line 221
2.

(/usr/share/texlive/texmf-dist/tex/latex/koma-script/scrsize11pt.clo
File: scrsize11pt.clo 2020/01/24 v3.29 KOMA-Script font size class option (11pt
)
)
(/usr/share/texlive/texmf-dist/tex/latex/koma-script/typearea.sty
Package: typearea 2020/01/24 v3.29 KOMA-Script package (type area)
\ta@bcor=\skip48
\ta@div=\count167
\ta@hblk=\skip49
\ta@vblk=\skip50
\ta@temp=\skip51
\footheight=\skip52
Package typearea Info: These are the values describing the layout:
(typearea) DIV = 10
(typearea) BCOR = 0.0pt
(typearea) \paperwidth = 597.50793pt
(typearea) \textwidth = 418.25555pt
(typearea) DIV departure = -6%
(typearea) \evensidemargin = 17.3562pt
(typearea) \oddsidemargin = 17.3562pt
(typearea) \paperheight = 845.04694pt
(typearea) \textheight = 595.80026pt
(typearea) \topmargin = -25.16531pt
(typearea) \headheight = 17.0pt
(typearea) \headsep = 20.40001pt
(typearea) \topskip = 11.0pt
(typearea) \footskip = 47.6pt
(typearea) \baselineskip = 13.6pt
(typearea) on input line 1719.
)
\c@part=\count168
\c@section=\count169
\c@subsection=\count170
\c@subsubsection=\count171
\c@paragraph=\count172
\c@subparagraph=\count173
\scr@dte@section@maxnumwidth=\skip53
Class scrartcl Info: using compatibility default `runin=bysign'
(scrartcl) for `\section on input line 4723.
Class scrartcl Info: using compatibility default `afterindent=bysign'
(scrartcl) for `\section on input line 4723.
\scr@dte@part@maxnumwidth=\skip54
Class scrartcl Info: using compatibility default `afterindent=false'
(scrartcl) for `\part on input line 4731.
\scr@dte@subsection@maxnumwidth=\skip55
Class scrartcl Info: using compatibility default `runin=bysign'
(scrartcl) for `\subsection on input line 4741.
Class scrartcl Info: using compatibility default `afterindent=bysign'
(scrartcl) for `\subsection on input line 4741.
\scr@dte@subsubsection@maxnumwidth=\skip56
Class scrartcl Info: using compatibility default `runin=bysign'
(scrartcl) for `\subsubsection on input line 4751.
Class scrartcl Info: using compatibility default `afterindent=bysign'
(scrartcl) for `\subsubsection on input line 4751.
\scr@dte@paragraph@maxnumwidth=\skip57
Class scrartcl Info: using compatibility default `runin=bysign'
(scrartcl) for `\paragraph on input line 4761.
Class scrartcl Info: using compatibility default `afterindent=bysign'
(scrartcl) for `\paragraph on input line 4761.
\scr@dte@subparagraph@maxnumwidth=\skip58
Class scrartcl Info: using compatibility default `runin=bysign'
(scrartcl) for `\subparagraph on input line 4771.
Class scrartcl Info: using compatibility default `afterindent=bysign'
(scrartcl) for `\subparagraph on input line 4771.
\abovecaptionskip=\skip59
\belowcaptionskip=\skip60
\c@pti@nb@sid@b@x=\box46
Package tocbasic Info: omitting babel extension for `lof'
(tocbasic) because of feature `nobabel' available
(tocbasic) for `lof' on input line 6002.
\scr@dte@figure@maxnumwidth=\skip61
\c@figure=\count174
Package tocbasic Info: omitting babel extension for `lot'
(tocbasic) because of feature `nobabel' available
(tocbasic) for `lot' on input line 6014.
\scr@dte@table@maxnumwidth=\skip62
\c@table=\count175
Class scrartcl Info: Redefining `\numberline' on input line 6178.
\bibindent=\dimen134
)
(/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty
Package: inputenc 2018/08/11 v1.3c Input encoding file
\inpenc@prehook=\toks15
\inpenc@posthook=\toks16
)
(/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty
Package: fontenc 2020/02/11 v2.0o Standard LaTeX package
)
(/usr/share/texlive/texmf-dist/tex/latex/lipsum/lipsum.sty
(/usr/share/texlive/texmf-dist/tex/latex/l3kernel/expl3.sty
Package: expl3 2020-02-14 L3 programming layer (loader)

(/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.def
File: l3backend-pdfmode.def 2020-02-03 L3 backend support: PDF mode
\l__kernel_color_stack_int=\count176
\l__pdf_internal_box=\box47
))
(/usr/share/texlive/texmf-dist/tex/latex/l3packages/xparse/xparse.sty
Package: xparse 2020-02-14 L3 Experimental document command parser
\l__xparse_current_arg_int=\count177
\g__xparse_grabber_int=\count178
\l__xparse_m_args_int=\count179
\l__xparse_v_nesting_int=\count180
)
Package: lipsum 2019/01/02 v2.2 150 paragraphs of Lorem Ipsum dummy text

(/usr/share/texlive/texmf-dist/tex/latex/lipsum/lipsum.ltd.tex
File: lipsum.ltd.tex 2019/01/02 v2.2 The Lorem ipsum dummy text
))
(/usr/share/texlive/texmf-dist/tex/latex/siunitx/siunitx.sty
Package: siunitx 2020/01/15 v2.7u A comprehensive (SI) units package

(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty
Package: amstext 2000/06/29 v2.01 AMS text

(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty
File: amsgen.sty 1999/11/30 v2.0 generic functions
\@emptytoks=\toks17
\ex@=\dimen135
))
(/usr/share/texlive/texmf-dist/tex/latex/tools/array.sty
Package: array 2019/08/31 v2.4l Tabular extension package (FMi)
\col@sep=\dimen136
\ar@mcellbox=\box48
\extrarowheight=\dimen137
\NC@list=\toks18
\extratabsurround=\skip63
\backup@length=\skip64
\ar@cellbox=\box49
)
(/usr/share/texlive/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty
Package: l3keys2e 2020-02-14 LaTeX2e option processing using LaTeX3 keys
)
\l__siunitx_tmp_box=\box50
\l__siunitx_tmp_dim=\dimen138
\l__siunitx_tmp_int=\count181
\l__siunitx_number_mantissa_length_int=\count182
\l__siunitx_number_uncert_length_int=\count183
\l__siunitx_round_int=\count184
\l__siunitx_process_decimal_int=\count185
\l__siunitx_process_uncertainty_int=\count186
\l__siunitx_process_fixed_int=\count187
\l__siunitx_process_integer_min_int=\count188
\l__siunitx_process_precision_int=\count189
\l__siunitx_group_min_int=\count190
\l__siunitx_angle_marker_box=\box51
\l__siunitx_angle_unit_box=\box52
\l__siunitx_angle_marker_dim=\dimen139
\l__siunitx_angle_unit_dim=\dimen140
\l__siunitx_unit_int=\count191
\l__siunitx_unit_denominator_int=\count192
\l__siunitx_unit_numerator_int=\count193
\l__siunitx_unit_prefix_int=\count194
\l__siunitx_unit_prefix_base_int=\count195
\l__siunitx_unit_prefix_gram_int=\count196
\l__siunitx_number_product_int=\count197
\c__siunitx_one_fill_skip=\skip65
\l__siunitx_table_unit_align_skip=\skip66
\l__siunitx_table_exponent_dim=\dimen141
\l__siunitx_table_integer_dim=\dimen142
\l__siunitx_table_mantissa_dim=\dimen143
\l__siunitx_table_marker_dim=\dimen144
\l__siunitx_table_result_dim=\dimen145
\l__siunitx_table_uncert_dim=\dimen146
\l__siunitx_table_fill_pre_dim=\dimen147
\l__siunitx_table_fill_post_dim=\dimen148
\l__siunitx_table_fill_mid_dim=\dimen149
\l__siunitx_table_pre_box=\box53
\l__siunitx_table_post_box=\box54
\l__siunitx_table_mantissa_box=\box55
\l__siunitx_table_result_box=\box56
\l__siunitx_table_number_align_skip=\skip67
\l__siunitx_table_text_align_skip=\skip68

(/usr/share/texlive/texmf-dist/tex/latex/translator/translator.sty
Package: translator 2019-05-31 v1.12a Easy translation of strings in LaTeX
)))
No file main_test.aux.
\openout1 = `main_test.aux'.

LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 4.
LaTeX Font Info: ... okay on input line 4.
Package scrbase Info: activating english \contentsname on input line 4.
Package scrbase Info: activating english \listfigurename on input line 4.
Package scrbase Info: activating english \listtablename on input line 4.

(/usr/share/texlive/texmf-dist/tex/latex/translator/translator-basic-dictionary
-English.dict
Dictionary: translator-basic-dictionary, Language: English
)
(/usr/share/texlive/texmf-dist/tex/latex/siunitx/siunitx-abbreviations.cfg
File: siunitx-abbreviations.cfg 2017/11/26 v2.7k siunitx: Abbreviated units
)
(/usr/share/texlive/texmf-dist/tex/latex/physics/physics.sty
Package: physics

(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty
Package: amsmath 2020/01/20 v2.17e AMS math features
\@mathmargin=\skip69

For additional information on amsmath, use the `?' option.
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty
Package: amsbsy 1999/11/29 v1.2d Bold Symbols
\pmbraise@=\dimen150
)
(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty
Package: amsopn 2016/03/08 v2.02 operator names
)
\inf@bad=\count198
LaTeX Info: Redefining \frac on input line 227.
\uproot@=\count199
\leftroot@=\count266
LaTeX Info: Redefining \overline on input line 389.
\classnum@=\count267
\DOTSCASE@=\count268
LaTeX Info: Redefining \ldots on input line 486.
LaTeX Info: Redefining \dots on input line 489.
LaTeX Info: Redefining \cdots on input line 610.
\Mathstrutbox@=\box57
\strutbox@=\box58
\big@size=\dimen151
LaTeX Font Info: Redeclaring font encoding OML on input line 733.
LaTeX Font Info: Redeclaring font encoding OMS on input line 734.
\macc@depth=\count269
\c@MaxMatrixCols=\count270
\dotsspace@=\muskip16
\c@parentequation=\count271
\dspbrk@lvl=\count272
\tag@help=\toks19
\row@=\count273
\column@=\count274
\maxfields@=\count275
\andhelp@=\toks20
\eqnshift@=\dimen152
\alignsep@=\dimen153
\tagshift@=\dimen154
\tagwidth@=\dimen155
\totwidth@=\dimen156
\lineht@=\dimen157
\@envbody=\toks21
\multlinegap=\skip70
\multlinetaggap=\skip71
\mathdisplay@stack=\toks22
LaTeX Info: Redefining \[ on input line 2859.
LaTeX Info: Redefining \] on input line 2860.
))
./main_test.tex:4: Undefined control sequence.
<recently read> \RenewCommandCopy

l.4 \begin{document}

The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

./main_test.tex:4: Argument of \SI has an extra }.
<inserted text>
\par
l.4 \begin{document}

I've run across a `}' that doesn't seem to match anything.
For example, `\def\a#1{...}' and `\a}' would produce
this error. If you simply proceed now, the `\par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your `}' was spurious, just type `2' and it will go away.

Runaway argument?
./main_test.tex:4: Paragraph ended before \SI was complete.
<to be read again>
\par
l.4 \begin{document}

I suspect you've forgotten a `}', causing me to apply this
control sequence to too much text. How can we recover?
My plan is to forget the whole thing and hope for the best.

[1

{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] [2] (./main_test.aux) )
Here is how much of TeX's memory you used:
7301 strings out of 481239
161978 string characters out of 5920378
753976 words of memory out of 5000000
22553 multiletter control sequences out of 15000+600000
537929 words of font info for 43 fonts, out of 8000000 for 9000
1141 hyphenation exceptions out of 8191
49i,6n,57p,10105b,246s stack positions out of 5000i,500n,10000p,200000b,80000s
{/u
sr/share/texmf/fonts/enc/dvips/cm-super/cm-super-t1.enc}</usr/share/texmf/fonts
/type1/public/cm-super/sfrm1095.pfb>
Output written on main_test.pdf (2 pages, 26114 bytes).
PDF statistics:
16 PDF objects out of 1000 (max. 8388607)
10 compressed objects within 1 object stream
0 named destinations out of 1000 (max. 500000)
1 words of extra memory for PDF output out of 10000 (max. 10000000)
----------------------------------------------

rais
Posts: 412
Joined: Sun Nov 16, 2014 8:51 pm

\RenewCommandCopy raises "Undefined control sequence" error

Postby rais » Mon Aug 14, 2023 8:12 pm

newbie9999 wrote:This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=pdflatex 2023.6.2) 14 AUG 2023 12:07

That explains it, then: \RenewCommandCopy and friends were introduced to the LaTeX Kernel around Oct 20, for which you'd need TeX Live 2020, at least.
newbie9999 wrote:(/usr/share/texlive/texmf-dist/tex/latex/siunitx/siunitx.sty
Package: siunitx 2020/01/15 v2.7u A comprehensive (SI) units package

Then again, why do you even bother? Your version of siunitx doesn't even provide a \qty command yet---that came with the switch to version 3 of that package, around TeX Live 2021.

KR
Rainer

newbie9999
Posts: 3
Joined: Sun Aug 13, 2023 1:51 pm

\RenewCommandCopy raises "Undefined control sequence" error

Postby newbie9999 » Fri Aug 18, 2023 9:43 pm

Thank you!

I edit my .tex in local with auctex but then share it on overleaf with other people for collaborative editing.
\RenewCommandCopy is required on overleaf to avoid a warning and that is why I would like to keep it.

Would you know how I could update my LaTex kernel?

rais
Posts: 412
Joined: Sun Nov 16, 2014 8:51 pm

\RenewCommandCopy raises "Undefined control sequence" error

Postby rais » Sat Aug 19, 2023 10:25 pm

You're using a pre-packaged version of TeX Live.
Either update your Linux installation or install the current TeX Live yourself, in which case you may need to convince your Linux package manager that LaTeX is installed to satisfy package dependencies, see https://tug.org/texlive/debian.html#vanilla.

KR
Rainer

NildaFord
Posts: 1
Joined: Tue Oct 17, 2023 1:28 pm

\RenewCommandCopy raises "Undefined control sequence" error

Postby NildaFord » Wed Oct 18, 2023 11:21 am

The "Undefined control sequence" error in AUCTeX may be due to `\RenewCommandCopy`. Try adding `\usepackage{letltxmacro}` in your "my_article.cls" file to resolve the issue. This ensures AUCTeX recognizes the command, making it work as expected.


Return to “AUCTeX”

Who is online

Users browsing this forum: No registered users and 3 guests