Why latex does not tell me which command is undefined? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)Test if a package (or package option) is loadedmakecvtitle doesn't work with moderncv in MiKTeX 2.9Sublime Text 2 - use typeset latex instead of pdflatexclassics package throws weird error messageProblems compiling arXiv LaTeX source filesLatexmk: Stop processing on pdflatex errorSlight package bug about Babel/efrenchUndefined control sequence GNU C Library manual texinfo.texInserting bibliography .bbl directly into .tex file causes Undefined control sequencetexmaker does not recognize the new packageTexmaker - Mactex - MacOs Sierra weird problems

In musical terms, what properties are varied by the human voice to produce different words / syllables?

My mentor says to set image to Fine instead of RAW — how is this different from JPG?

Why not send Voyager 3 and 4 following up the paths taken by Voyager 1 and 2 to re-transmit signals of later as they fly away from Earth?

Test print coming out spongy

How can a team of shapeshifters communicate?

Sally's older brother

Flight departed from the gate 5 min before scheduled departure time. Refund options

What is the chair depicted in Cesare Maccari's 1889 painting "Cicerone denuncia Catilina"?

What is the difference between a "ranged attack" and a "ranged weapon attack"?

Central Vacuuming: Is it worth it, and how does it compare to normal vacuuming?

Is openssl rand command cryptographically secure?

Random body shuffle every night—can we still function?

RSA find public exponent

Tips to organize LaTeX presentations for a semester

Putting class ranking in CV, but against dept guidelines

Special flights

Getting out of while loop on console

Tannaka duality for semisimple groups

Are the endpoints of the domain of a function counted as critical points?

After Sam didn't return home in the end, were he and Al still friends?

Why is std::move not [[nodiscard]] in C++20?

Why datecode is SO IMPORTANT to chip manufacturers?

Nose gear failure in single prop aircraft: belly landing or nose-gear up landing?

Universal covering space of the real projective line?



Why latex does not tell me which command is undefined?



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)Test if a package (or package option) is loadedmakecvtitle doesn't work with moderncv in MiKTeX 2.9Sublime Text 2 - use typeset latex instead of pdflatexclassics package throws weird error messageProblems compiling arXiv LaTeX source filesLatexmk: Stop processing on pdflatex errorSlight package bug about Babel/efrenchUndefined control sequence GNU C Library manual texinfo.texInserting bibliography .bbl directly into .tex file causes Undefined control sequencetexmaker does not recognize the new packageTexmaker - Mactex - MacOs Sierra weird problems










0















From the beginning, took me a lot of time to come with the following minimal example:



PassOptionsToPackagemain=brazil,english,spanish,frenchbabel

documentclass[
10pt,
a5paper,
]memoir

makeatletter
@ifpackagewithbabelenglishmessageEnglish YES!^^JmessageEnglish NO!^^J
@ifpackagewithbabelbrazilmessageBrazil YES!^^JmessageBrazil NO!^^J
@ifpackagewithbabelturkishmessageTurkish YES!^^JmessageTurkish NO!^^J

@ifpackagewithbabelbraziladdtocaptionsbrazilrenewcommandlstlistingnameCódigo
@ifpackagewithbabelenglishaddtocaptionsenglishrenewcommandlstlistingnameCode
makeatother

begindocument
chapterIntroduction
Thing.
enddocument


Runnning this example with:



'latexmk.exe' -cd -f -pdf -interaction=nonstopmode -synctex=1 '--output-directory=cache' -latexoption=-file-line-error -latexoption=-halt-on-error -latexoption=--max-print-line=10000 test1.tex



$ tex --version
MiKTeX-TeX 2.9.6300 (3.14159265) (MiKTeX 2.9.6400)]

...
Package tabularx [2008/07/23] emulated by memoir.
Package titleref [2008/07/23] emulated by memoir.
Package titling [2008/07/23] emulated by memoir.
Package tocbibind [2008/07/23] emulated by memoir.
Package tocloft [2008/07/23] emulated by memoir.
Package tocvsec2 [2008/07/23] emulated by memoir.
Package verbatim [2008/07/23] emulated by memoir.
Package verse [2008/07/23] emulated by memoir.
(D:UserDocumentslatextexmfsinstalltexlatexmemoirmempatch.sty
Package: mempatch 2009/07/24 v6.0f Patches for memoir class v1.6180339
)) English YES!
Brazil NO!
Turkish NO!
test1.tex:17: Undefined control sequence
Here is how much of TeX's memory you used:
3506 strings out of 493314
47031 string characters out of 3134142
129114 words of memory out of 3000000
7118 multiletter control sequences out of 15000+200000
4238 words of font info for 16 fonts, out of 3000000 for 9000
1141 hyphenation exceptions out of 8191
24i,1n,22p,129b,62s stack positions out of 5000i,500n,10000p,200000b,50000s

test1.tex:17: ==> Fatal error occurred, no output PDF file produced!


Latex does not tell me on its log which command is not defined. It only says Undefined control sequence, which is very much useless.



How can I make latex tell me exactly which command he is not finding defined?



Only after a lot of trying, I figured out that the ifpackagewith does not check whether the package is loaded. It only checks whether there is some option on the package name queue.



Then, a fixed version is:



makeatletter
@ifpackageloadedbabel@ifpackagewithbabelenglishmessageEnglish YES!^^JmessageEnglish NO!^^J
@ifpackageloadedbabel@ifpackagewithbabelbrazilmessageBrazil YES!^^JmessageBrazil NO!^^J
@ifpackageloadedbabel@ifpackagewithbabelturkishmessageTurkish YES!^^JmessageTurkish NO!^^J

@ifpackageloadedbabel@ifpackagewithbabelbraziladdtocaptionsbrazilrenewcommandlstlistingnameCódigo
@ifpackageloadedbabel@ifpackagewithbabelenglishaddtocaptionsenglishrenewcommandlstlistingnameCode
makeatother


Or just load the babel package with RequirePackagebabel.




Now, forgetting about the fix, which is load babel or use @ifpackageloaded. Why latex does not tell me which command was undefined from the beginning???



If I remove the -latexoption=-halt-on-error, then, latex tells me the command lstlistingname is undefined, but that is the WRONG command. The command which is undefined is addtocaptions from babel package, which was not loaded.



See here the output from latex:



'latexmk.exe' -cd -f -pdf -interaction=nonstopmode -synctex=1 '--output-directory=cache' -latexoption=-file-line-error -latexoption=--max-print-line=10000 test1.tex



xmemoirmempatch.sty)) English YES!
Brazil NO!
Turkish NO!
test1.tex:15: Undefined control sequence
test1.tex:15: Undefined control sequence

test1.tex:15: LaTeX Error: lstlistingname undefined.

See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help


If I remove the lstlistingname from the input program like this:



makeatletter
@ifpackagewithbabelenglishmessageEnglish YES!^^JmessageEnglish NO!^^J
@ifpackagewithbabelbrazilmessageBrazil YES!^^JmessageBrazil NO!^^J
@ifpackagewithbabelturkishmessageTurkish YES!^^JmessageTurkish NO!^^J

@ifpackagewithbabelbraziladdtocaptionsbrazil
@ifpackagewithbabelenglishaddtocaptionsenglish
makeatother


And run back latex again, without the -interaction=nonstopmode and -latexoption=-halt-on-error, then, latex tells me absolutely nothing about which command is undefined!



'latexmk.exe' -cd -f -pdf '--output-directory=cache' -latexoption=-file-line-error -latexoption=--max-print-line=10000 test1.tex



Latexmk: This is Latexmk, John Collins, 19 Jan. 2017, version: 4.52c.
Latexmk: Changing directory to './'
Latexmk: making output directory 'cache'
Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex': Rules & subrules not known to be previously run:
pdflatex
Rule 'pdflatex': The following rules & subrules became out-of-date:
'pdflatex'
------------
Run number 1 of rule 'pdflatex'
------------
------------
Running 'pdflatex -file-line-error --max-print-line=10000 -recorder -output-directory="cache" "test1.tex"'
------------
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (MiKTeX 2.9.6400)
entering extended mode
(test1.tex
LaTeX2e <2017-04-15>
Babel <3.12> and hyphenation patterns for 76 language(s) loaded.
(D:UserDocumentslatextexmfsinstalltexlatexmemoirmemoir.cls
Document Class: memoir 2016/05/16 v3.7f configurable book, report, article document class
(D:UserDocumentslatextexmfsinstalltexgenericoberdiekifpdf.sty) (D:UserDocumentslatextexmfsinstalltexlatexifetexifetex.sty (D:UserDocumentslatextexmfsinstalltexplainifetexifetex.tex)) (D:UserDocumentslatextexmfsinstalltexgenericifxetexifxetex.sty) (D:UserDocumentslatextexmfsinstalltexgenericoberdiekifluatex.sty) (D:UserDocumentslatextexmfsinstalltexlatexmemoirmem10.clo) (D:UserDocumentslatextexmfsinstalltexlatexmemoirmempatch.sty)) English YES!
Brazil NO!
Turkish NO!
test1.tex:15: Undefined control sequence
test1.tex:15: Undefined control sequence
(D:Testcachetest1.aux) [1D:/User/Documents/latex/texmfs/data/pdftex/config/pdftex.map] (D:Testcachetest1.aux) )
(see the transcript file for additional information)<D:/User/Documents/latex/texmfs/install/fonts/type1/public/amsfonts/cm/cmbx12.pfb><D:/User/Documents/latex/texmfs/install/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on D:Testcachetest1.pdf (1 page, 21716 bytes).
Transcript written on D:Testcachetest1.log.
=== TeX engine is 'pdfTeX'
Latexmk: Log file says output to 'cache/test1.pdf'
Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex': File changes, etc:
Changed files, or newly in use since previous run(s):
'cache/test1.aux'
------------
Run number 2 of rule 'pdflatex'
------------
------------
Running 'pdflatex -file-line-error --max-print-line=10000 -recorder -output-directory="cache" "test1.tex"'
------------
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (MiKTeX 2.9.6400)
entering extended mode
(test1.tex
LaTeX2e <2017-04-15>
Babel <3.12> and hyphenation patterns for 76 language(s) loaded.
(D:UserDocumentslatextexmfsinstalltexlatexmemoirmemoir.cls
Document Class: memoir 2016/05/16 v3.7f configurable book, report, article document class
(D:UserDocumentslatextexmfsinstalltexgenericoberdiekifpdf.sty) (D:UserDocumentslatextexmfsinstalltexlatexifetexifetex.sty (D:UserDocumentslatextexmfsinstalltexplainifetexifetex.tex)) (D:UserDocumentslatextexmfsinstalltexgenericifxetexifxetex.sty) (D:UserDocumentslatextexmfsinstalltexgenericoberdiekifluatex.sty) (D:UserDocumentslatextexmfsinstalltexlatexmemoirmem10.clo) (D:UserDocumentslatextexmfsinstalltexlatexmemoirmempatch.sty)) English YES!
Brazil NO!
Turkish NO!
test1.tex:15: Undefined control sequence
test1.tex:15: Undefined control sequence
(D:Testcachetest1.aux) [1D:/User/Documents/latex/texmfs/data/pdftex/config/pdftex.map] (D:Testcachetest1.aux) )
(see the transcript file for additional information)<D:/User/Documents/latex/texmfs/install/fonts/type1/public/amsfonts/cm/cmbx12.pfb><D:/User/Documents/latex/texmfs/install/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on D:Testcachetest1.pdf (1 page, 21716 bytes).
Transcript written on D:Testcachetest1.log.
=== TeX engine is 'pdfTeX'
Latexmk: Log file says output to 'cache/test1.pdf'
Latexmk: Errors, in force_mode: so I tried finishing targets
Collected error summary (may duplicate other messages):
pdflatex: Command for 'pdflatex' gave return code 1
Refer to 'cache/test1.log' for details
Latexmk: Undoing directory change


Why latex does not tell which command is not defined? Does it hurt him? Is he afraid it is too much information and I cannot handle it by myself???



Is there some fix I can apply to latex, so it starts telling me which commands is not defined when there is some error?



References:



  1. http://tex.stackexchange.com/questions/228936/setting-entries-of-list-of-listings-in-latex-package-listings

  2. Test if a package (or package option) is loaded








share






















  • I do not understand the behavior of latexmk but pdflatex tells me addto is undefined.

    – Symbol 1
    2 mins ago















0















From the beginning, took me a lot of time to come with the following minimal example:



PassOptionsToPackagemain=brazil,english,spanish,frenchbabel

documentclass[
10pt,
a5paper,
]memoir

makeatletter
@ifpackagewithbabelenglishmessageEnglish YES!^^JmessageEnglish NO!^^J
@ifpackagewithbabelbrazilmessageBrazil YES!^^JmessageBrazil NO!^^J
@ifpackagewithbabelturkishmessageTurkish YES!^^JmessageTurkish NO!^^J

@ifpackagewithbabelbraziladdtocaptionsbrazilrenewcommandlstlistingnameCódigo
@ifpackagewithbabelenglishaddtocaptionsenglishrenewcommandlstlistingnameCode
makeatother

begindocument
chapterIntroduction
Thing.
enddocument


Runnning this example with:



'latexmk.exe' -cd -f -pdf -interaction=nonstopmode -synctex=1 '--output-directory=cache' -latexoption=-file-line-error -latexoption=-halt-on-error -latexoption=--max-print-line=10000 test1.tex



$ tex --version
MiKTeX-TeX 2.9.6300 (3.14159265) (MiKTeX 2.9.6400)]

...
Package tabularx [2008/07/23] emulated by memoir.
Package titleref [2008/07/23] emulated by memoir.
Package titling [2008/07/23] emulated by memoir.
Package tocbibind [2008/07/23] emulated by memoir.
Package tocloft [2008/07/23] emulated by memoir.
Package tocvsec2 [2008/07/23] emulated by memoir.
Package verbatim [2008/07/23] emulated by memoir.
Package verse [2008/07/23] emulated by memoir.
(D:UserDocumentslatextexmfsinstalltexlatexmemoirmempatch.sty
Package: mempatch 2009/07/24 v6.0f Patches for memoir class v1.6180339
)) English YES!
Brazil NO!
Turkish NO!
test1.tex:17: Undefined control sequence
Here is how much of TeX's memory you used:
3506 strings out of 493314
47031 string characters out of 3134142
129114 words of memory out of 3000000
7118 multiletter control sequences out of 15000+200000
4238 words of font info for 16 fonts, out of 3000000 for 9000
1141 hyphenation exceptions out of 8191
24i,1n,22p,129b,62s stack positions out of 5000i,500n,10000p,200000b,50000s

test1.tex:17: ==> Fatal error occurred, no output PDF file produced!


Latex does not tell me on its log which command is not defined. It only says Undefined control sequence, which is very much useless.



How can I make latex tell me exactly which command he is not finding defined?



Only after a lot of trying, I figured out that the ifpackagewith does not check whether the package is loaded. It only checks whether there is some option on the package name queue.



Then, a fixed version is:



makeatletter
@ifpackageloadedbabel@ifpackagewithbabelenglishmessageEnglish YES!^^JmessageEnglish NO!^^J
@ifpackageloadedbabel@ifpackagewithbabelbrazilmessageBrazil YES!^^JmessageBrazil NO!^^J
@ifpackageloadedbabel@ifpackagewithbabelturkishmessageTurkish YES!^^JmessageTurkish NO!^^J

@ifpackageloadedbabel@ifpackagewithbabelbraziladdtocaptionsbrazilrenewcommandlstlistingnameCódigo
@ifpackageloadedbabel@ifpackagewithbabelenglishaddtocaptionsenglishrenewcommandlstlistingnameCode
makeatother


Or just load the babel package with RequirePackagebabel.




Now, forgetting about the fix, which is load babel or use @ifpackageloaded. Why latex does not tell me which command was undefined from the beginning???



If I remove the -latexoption=-halt-on-error, then, latex tells me the command lstlistingname is undefined, but that is the WRONG command. The command which is undefined is addtocaptions from babel package, which was not loaded.



See here the output from latex:



'latexmk.exe' -cd -f -pdf -interaction=nonstopmode -synctex=1 '--output-directory=cache' -latexoption=-file-line-error -latexoption=--max-print-line=10000 test1.tex



xmemoirmempatch.sty)) English YES!
Brazil NO!
Turkish NO!
test1.tex:15: Undefined control sequence
test1.tex:15: Undefined control sequence

test1.tex:15: LaTeX Error: lstlistingname undefined.

See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help


If I remove the lstlistingname from the input program like this:



makeatletter
@ifpackagewithbabelenglishmessageEnglish YES!^^JmessageEnglish NO!^^J
@ifpackagewithbabelbrazilmessageBrazil YES!^^JmessageBrazil NO!^^J
@ifpackagewithbabelturkishmessageTurkish YES!^^JmessageTurkish NO!^^J

@ifpackagewithbabelbraziladdtocaptionsbrazil
@ifpackagewithbabelenglishaddtocaptionsenglish
makeatother


And run back latex again, without the -interaction=nonstopmode and -latexoption=-halt-on-error, then, latex tells me absolutely nothing about which command is undefined!



'latexmk.exe' -cd -f -pdf '--output-directory=cache' -latexoption=-file-line-error -latexoption=--max-print-line=10000 test1.tex



Latexmk: This is Latexmk, John Collins, 19 Jan. 2017, version: 4.52c.
Latexmk: Changing directory to './'
Latexmk: making output directory 'cache'
Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex': Rules & subrules not known to be previously run:
pdflatex
Rule 'pdflatex': The following rules & subrules became out-of-date:
'pdflatex'
------------
Run number 1 of rule 'pdflatex'
------------
------------
Running 'pdflatex -file-line-error --max-print-line=10000 -recorder -output-directory="cache" "test1.tex"'
------------
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (MiKTeX 2.9.6400)
entering extended mode
(test1.tex
LaTeX2e <2017-04-15>
Babel <3.12> and hyphenation patterns for 76 language(s) loaded.
(D:UserDocumentslatextexmfsinstalltexlatexmemoirmemoir.cls
Document Class: memoir 2016/05/16 v3.7f configurable book, report, article document class
(D:UserDocumentslatextexmfsinstalltexgenericoberdiekifpdf.sty) (D:UserDocumentslatextexmfsinstalltexlatexifetexifetex.sty (D:UserDocumentslatextexmfsinstalltexplainifetexifetex.tex)) (D:UserDocumentslatextexmfsinstalltexgenericifxetexifxetex.sty) (D:UserDocumentslatextexmfsinstalltexgenericoberdiekifluatex.sty) (D:UserDocumentslatextexmfsinstalltexlatexmemoirmem10.clo) (D:UserDocumentslatextexmfsinstalltexlatexmemoirmempatch.sty)) English YES!
Brazil NO!
Turkish NO!
test1.tex:15: Undefined control sequence
test1.tex:15: Undefined control sequence
(D:Testcachetest1.aux) [1D:/User/Documents/latex/texmfs/data/pdftex/config/pdftex.map] (D:Testcachetest1.aux) )
(see the transcript file for additional information)<D:/User/Documents/latex/texmfs/install/fonts/type1/public/amsfonts/cm/cmbx12.pfb><D:/User/Documents/latex/texmfs/install/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on D:Testcachetest1.pdf (1 page, 21716 bytes).
Transcript written on D:Testcachetest1.log.
=== TeX engine is 'pdfTeX'
Latexmk: Log file says output to 'cache/test1.pdf'
Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex': File changes, etc:
Changed files, or newly in use since previous run(s):
'cache/test1.aux'
------------
Run number 2 of rule 'pdflatex'
------------
------------
Running 'pdflatex -file-line-error --max-print-line=10000 -recorder -output-directory="cache" "test1.tex"'
------------
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (MiKTeX 2.9.6400)
entering extended mode
(test1.tex
LaTeX2e <2017-04-15>
Babel <3.12> and hyphenation patterns for 76 language(s) loaded.
(D:UserDocumentslatextexmfsinstalltexlatexmemoirmemoir.cls
Document Class: memoir 2016/05/16 v3.7f configurable book, report, article document class
(D:UserDocumentslatextexmfsinstalltexgenericoberdiekifpdf.sty) (D:UserDocumentslatextexmfsinstalltexlatexifetexifetex.sty (D:UserDocumentslatextexmfsinstalltexplainifetexifetex.tex)) (D:UserDocumentslatextexmfsinstalltexgenericifxetexifxetex.sty) (D:UserDocumentslatextexmfsinstalltexgenericoberdiekifluatex.sty) (D:UserDocumentslatextexmfsinstalltexlatexmemoirmem10.clo) (D:UserDocumentslatextexmfsinstalltexlatexmemoirmempatch.sty)) English YES!
Brazil NO!
Turkish NO!
test1.tex:15: Undefined control sequence
test1.tex:15: Undefined control sequence
(D:Testcachetest1.aux) [1D:/User/Documents/latex/texmfs/data/pdftex/config/pdftex.map] (D:Testcachetest1.aux) )
(see the transcript file for additional information)<D:/User/Documents/latex/texmfs/install/fonts/type1/public/amsfonts/cm/cmbx12.pfb><D:/User/Documents/latex/texmfs/install/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on D:Testcachetest1.pdf (1 page, 21716 bytes).
Transcript written on D:Testcachetest1.log.
=== TeX engine is 'pdfTeX'
Latexmk: Log file says output to 'cache/test1.pdf'
Latexmk: Errors, in force_mode: so I tried finishing targets
Collected error summary (may duplicate other messages):
pdflatex: Command for 'pdflatex' gave return code 1
Refer to 'cache/test1.log' for details
Latexmk: Undoing directory change


Why latex does not tell which command is not defined? Does it hurt him? Is he afraid it is too much information and I cannot handle it by myself???



Is there some fix I can apply to latex, so it starts telling me which commands is not defined when there is some error?



References:



  1. http://tex.stackexchange.com/questions/228936/setting-entries-of-list-of-listings-in-latex-package-listings

  2. Test if a package (or package option) is loaded








share






















  • I do not understand the behavior of latexmk but pdflatex tells me addto is undefined.

    – Symbol 1
    2 mins ago













0












0








0








From the beginning, took me a lot of time to come with the following minimal example:



PassOptionsToPackagemain=brazil,english,spanish,frenchbabel

documentclass[
10pt,
a5paper,
]memoir

makeatletter
@ifpackagewithbabelenglishmessageEnglish YES!^^JmessageEnglish NO!^^J
@ifpackagewithbabelbrazilmessageBrazil YES!^^JmessageBrazil NO!^^J
@ifpackagewithbabelturkishmessageTurkish YES!^^JmessageTurkish NO!^^J

@ifpackagewithbabelbraziladdtocaptionsbrazilrenewcommandlstlistingnameCódigo
@ifpackagewithbabelenglishaddtocaptionsenglishrenewcommandlstlistingnameCode
makeatother

begindocument
chapterIntroduction
Thing.
enddocument


Runnning this example with:



'latexmk.exe' -cd -f -pdf -interaction=nonstopmode -synctex=1 '--output-directory=cache' -latexoption=-file-line-error -latexoption=-halt-on-error -latexoption=--max-print-line=10000 test1.tex



$ tex --version
MiKTeX-TeX 2.9.6300 (3.14159265) (MiKTeX 2.9.6400)]

...
Package tabularx [2008/07/23] emulated by memoir.
Package titleref [2008/07/23] emulated by memoir.
Package titling [2008/07/23] emulated by memoir.
Package tocbibind [2008/07/23] emulated by memoir.
Package tocloft [2008/07/23] emulated by memoir.
Package tocvsec2 [2008/07/23] emulated by memoir.
Package verbatim [2008/07/23] emulated by memoir.
Package verse [2008/07/23] emulated by memoir.
(D:UserDocumentslatextexmfsinstalltexlatexmemoirmempatch.sty
Package: mempatch 2009/07/24 v6.0f Patches for memoir class v1.6180339
)) English YES!
Brazil NO!
Turkish NO!
test1.tex:17: Undefined control sequence
Here is how much of TeX's memory you used:
3506 strings out of 493314
47031 string characters out of 3134142
129114 words of memory out of 3000000
7118 multiletter control sequences out of 15000+200000
4238 words of font info for 16 fonts, out of 3000000 for 9000
1141 hyphenation exceptions out of 8191
24i,1n,22p,129b,62s stack positions out of 5000i,500n,10000p,200000b,50000s

test1.tex:17: ==> Fatal error occurred, no output PDF file produced!


Latex does not tell me on its log which command is not defined. It only says Undefined control sequence, which is very much useless.



How can I make latex tell me exactly which command he is not finding defined?



Only after a lot of trying, I figured out that the ifpackagewith does not check whether the package is loaded. It only checks whether there is some option on the package name queue.



Then, a fixed version is:



makeatletter
@ifpackageloadedbabel@ifpackagewithbabelenglishmessageEnglish YES!^^JmessageEnglish NO!^^J
@ifpackageloadedbabel@ifpackagewithbabelbrazilmessageBrazil YES!^^JmessageBrazil NO!^^J
@ifpackageloadedbabel@ifpackagewithbabelturkishmessageTurkish YES!^^JmessageTurkish NO!^^J

@ifpackageloadedbabel@ifpackagewithbabelbraziladdtocaptionsbrazilrenewcommandlstlistingnameCódigo
@ifpackageloadedbabel@ifpackagewithbabelenglishaddtocaptionsenglishrenewcommandlstlistingnameCode
makeatother


Or just load the babel package with RequirePackagebabel.




Now, forgetting about the fix, which is load babel or use @ifpackageloaded. Why latex does not tell me which command was undefined from the beginning???



If I remove the -latexoption=-halt-on-error, then, latex tells me the command lstlistingname is undefined, but that is the WRONG command. The command which is undefined is addtocaptions from babel package, which was not loaded.



See here the output from latex:



'latexmk.exe' -cd -f -pdf -interaction=nonstopmode -synctex=1 '--output-directory=cache' -latexoption=-file-line-error -latexoption=--max-print-line=10000 test1.tex



xmemoirmempatch.sty)) English YES!
Brazil NO!
Turkish NO!
test1.tex:15: Undefined control sequence
test1.tex:15: Undefined control sequence

test1.tex:15: LaTeX Error: lstlistingname undefined.

See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help


If I remove the lstlistingname from the input program like this:



makeatletter
@ifpackagewithbabelenglishmessageEnglish YES!^^JmessageEnglish NO!^^J
@ifpackagewithbabelbrazilmessageBrazil YES!^^JmessageBrazil NO!^^J
@ifpackagewithbabelturkishmessageTurkish YES!^^JmessageTurkish NO!^^J

@ifpackagewithbabelbraziladdtocaptionsbrazil
@ifpackagewithbabelenglishaddtocaptionsenglish
makeatother


And run back latex again, without the -interaction=nonstopmode and -latexoption=-halt-on-error, then, latex tells me absolutely nothing about which command is undefined!



'latexmk.exe' -cd -f -pdf '--output-directory=cache' -latexoption=-file-line-error -latexoption=--max-print-line=10000 test1.tex



Latexmk: This is Latexmk, John Collins, 19 Jan. 2017, version: 4.52c.
Latexmk: Changing directory to './'
Latexmk: making output directory 'cache'
Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex': Rules & subrules not known to be previously run:
pdflatex
Rule 'pdflatex': The following rules & subrules became out-of-date:
'pdflatex'
------------
Run number 1 of rule 'pdflatex'
------------
------------
Running 'pdflatex -file-line-error --max-print-line=10000 -recorder -output-directory="cache" "test1.tex"'
------------
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (MiKTeX 2.9.6400)
entering extended mode
(test1.tex
LaTeX2e <2017-04-15>
Babel <3.12> and hyphenation patterns for 76 language(s) loaded.
(D:UserDocumentslatextexmfsinstalltexlatexmemoirmemoir.cls
Document Class: memoir 2016/05/16 v3.7f configurable book, report, article document class
(D:UserDocumentslatextexmfsinstalltexgenericoberdiekifpdf.sty) (D:UserDocumentslatextexmfsinstalltexlatexifetexifetex.sty (D:UserDocumentslatextexmfsinstalltexplainifetexifetex.tex)) (D:UserDocumentslatextexmfsinstalltexgenericifxetexifxetex.sty) (D:UserDocumentslatextexmfsinstalltexgenericoberdiekifluatex.sty) (D:UserDocumentslatextexmfsinstalltexlatexmemoirmem10.clo) (D:UserDocumentslatextexmfsinstalltexlatexmemoirmempatch.sty)) English YES!
Brazil NO!
Turkish NO!
test1.tex:15: Undefined control sequence
test1.tex:15: Undefined control sequence
(D:Testcachetest1.aux) [1D:/User/Documents/latex/texmfs/data/pdftex/config/pdftex.map] (D:Testcachetest1.aux) )
(see the transcript file for additional information)<D:/User/Documents/latex/texmfs/install/fonts/type1/public/amsfonts/cm/cmbx12.pfb><D:/User/Documents/latex/texmfs/install/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on D:Testcachetest1.pdf (1 page, 21716 bytes).
Transcript written on D:Testcachetest1.log.
=== TeX engine is 'pdfTeX'
Latexmk: Log file says output to 'cache/test1.pdf'
Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex': File changes, etc:
Changed files, or newly in use since previous run(s):
'cache/test1.aux'
------------
Run number 2 of rule 'pdflatex'
------------
------------
Running 'pdflatex -file-line-error --max-print-line=10000 -recorder -output-directory="cache" "test1.tex"'
------------
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (MiKTeX 2.9.6400)
entering extended mode
(test1.tex
LaTeX2e <2017-04-15>
Babel <3.12> and hyphenation patterns for 76 language(s) loaded.
(D:UserDocumentslatextexmfsinstalltexlatexmemoirmemoir.cls
Document Class: memoir 2016/05/16 v3.7f configurable book, report, article document class
(D:UserDocumentslatextexmfsinstalltexgenericoberdiekifpdf.sty) (D:UserDocumentslatextexmfsinstalltexlatexifetexifetex.sty (D:UserDocumentslatextexmfsinstalltexplainifetexifetex.tex)) (D:UserDocumentslatextexmfsinstalltexgenericifxetexifxetex.sty) (D:UserDocumentslatextexmfsinstalltexgenericoberdiekifluatex.sty) (D:UserDocumentslatextexmfsinstalltexlatexmemoirmem10.clo) (D:UserDocumentslatextexmfsinstalltexlatexmemoirmempatch.sty)) English YES!
Brazil NO!
Turkish NO!
test1.tex:15: Undefined control sequence
test1.tex:15: Undefined control sequence
(D:Testcachetest1.aux) [1D:/User/Documents/latex/texmfs/data/pdftex/config/pdftex.map] (D:Testcachetest1.aux) )
(see the transcript file for additional information)<D:/User/Documents/latex/texmfs/install/fonts/type1/public/amsfonts/cm/cmbx12.pfb><D:/User/Documents/latex/texmfs/install/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on D:Testcachetest1.pdf (1 page, 21716 bytes).
Transcript written on D:Testcachetest1.log.
=== TeX engine is 'pdfTeX'
Latexmk: Log file says output to 'cache/test1.pdf'
Latexmk: Errors, in force_mode: so I tried finishing targets
Collected error summary (may duplicate other messages):
pdflatex: Command for 'pdflatex' gave return code 1
Refer to 'cache/test1.log' for details
Latexmk: Undoing directory change


Why latex does not tell which command is not defined? Does it hurt him? Is he afraid it is too much information and I cannot handle it by myself???



Is there some fix I can apply to latex, so it starts telling me which commands is not defined when there is some error?



References:



  1. http://tex.stackexchange.com/questions/228936/setting-entries-of-list-of-listings-in-latex-package-listings

  2. Test if a package (or package option) is loaded








share














From the beginning, took me a lot of time to come with the following minimal example:



PassOptionsToPackagemain=brazil,english,spanish,frenchbabel

documentclass[
10pt,
a5paper,
]memoir

makeatletter
@ifpackagewithbabelenglishmessageEnglish YES!^^JmessageEnglish NO!^^J
@ifpackagewithbabelbrazilmessageBrazil YES!^^JmessageBrazil NO!^^J
@ifpackagewithbabelturkishmessageTurkish YES!^^JmessageTurkish NO!^^J

@ifpackagewithbabelbraziladdtocaptionsbrazilrenewcommandlstlistingnameCódigo
@ifpackagewithbabelenglishaddtocaptionsenglishrenewcommandlstlistingnameCode
makeatother

begindocument
chapterIntroduction
Thing.
enddocument


Runnning this example with:



'latexmk.exe' -cd -f -pdf -interaction=nonstopmode -synctex=1 '--output-directory=cache' -latexoption=-file-line-error -latexoption=-halt-on-error -latexoption=--max-print-line=10000 test1.tex



$ tex --version
MiKTeX-TeX 2.9.6300 (3.14159265) (MiKTeX 2.9.6400)]

...
Package tabularx [2008/07/23] emulated by memoir.
Package titleref [2008/07/23] emulated by memoir.
Package titling [2008/07/23] emulated by memoir.
Package tocbibind [2008/07/23] emulated by memoir.
Package tocloft [2008/07/23] emulated by memoir.
Package tocvsec2 [2008/07/23] emulated by memoir.
Package verbatim [2008/07/23] emulated by memoir.
Package verse [2008/07/23] emulated by memoir.
(D:UserDocumentslatextexmfsinstalltexlatexmemoirmempatch.sty
Package: mempatch 2009/07/24 v6.0f Patches for memoir class v1.6180339
)) English YES!
Brazil NO!
Turkish NO!
test1.tex:17: Undefined control sequence
Here is how much of TeX's memory you used:
3506 strings out of 493314
47031 string characters out of 3134142
129114 words of memory out of 3000000
7118 multiletter control sequences out of 15000+200000
4238 words of font info for 16 fonts, out of 3000000 for 9000
1141 hyphenation exceptions out of 8191
24i,1n,22p,129b,62s stack positions out of 5000i,500n,10000p,200000b,50000s

test1.tex:17: ==> Fatal error occurred, no output PDF file produced!


Latex does not tell me on its log which command is not defined. It only says Undefined control sequence, which is very much useless.



How can I make latex tell me exactly which command he is not finding defined?



Only after a lot of trying, I figured out that the ifpackagewith does not check whether the package is loaded. It only checks whether there is some option on the package name queue.



Then, a fixed version is:



makeatletter
@ifpackageloadedbabel@ifpackagewithbabelenglishmessageEnglish YES!^^JmessageEnglish NO!^^J
@ifpackageloadedbabel@ifpackagewithbabelbrazilmessageBrazil YES!^^JmessageBrazil NO!^^J
@ifpackageloadedbabel@ifpackagewithbabelturkishmessageTurkish YES!^^JmessageTurkish NO!^^J

@ifpackageloadedbabel@ifpackagewithbabelbraziladdtocaptionsbrazilrenewcommandlstlistingnameCódigo
@ifpackageloadedbabel@ifpackagewithbabelenglishaddtocaptionsenglishrenewcommandlstlistingnameCode
makeatother


Or just load the babel package with RequirePackagebabel.




Now, forgetting about the fix, which is load babel or use @ifpackageloaded. Why latex does not tell me which command was undefined from the beginning???



If I remove the -latexoption=-halt-on-error, then, latex tells me the command lstlistingname is undefined, but that is the WRONG command. The command which is undefined is addtocaptions from babel package, which was not loaded.



See here the output from latex:



'latexmk.exe' -cd -f -pdf -interaction=nonstopmode -synctex=1 '--output-directory=cache' -latexoption=-file-line-error -latexoption=--max-print-line=10000 test1.tex



xmemoirmempatch.sty)) English YES!
Brazil NO!
Turkish NO!
test1.tex:15: Undefined control sequence
test1.tex:15: Undefined control sequence

test1.tex:15: LaTeX Error: lstlistingname undefined.

See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help


If I remove the lstlistingname from the input program like this:



makeatletter
@ifpackagewithbabelenglishmessageEnglish YES!^^JmessageEnglish NO!^^J
@ifpackagewithbabelbrazilmessageBrazil YES!^^JmessageBrazil NO!^^J
@ifpackagewithbabelturkishmessageTurkish YES!^^JmessageTurkish NO!^^J

@ifpackagewithbabelbraziladdtocaptionsbrazil
@ifpackagewithbabelenglishaddtocaptionsenglish
makeatother


And run back latex again, without the -interaction=nonstopmode and -latexoption=-halt-on-error, then, latex tells me absolutely nothing about which command is undefined!



'latexmk.exe' -cd -f -pdf '--output-directory=cache' -latexoption=-file-line-error -latexoption=--max-print-line=10000 test1.tex



Latexmk: This is Latexmk, John Collins, 19 Jan. 2017, version: 4.52c.
Latexmk: Changing directory to './'
Latexmk: making output directory 'cache'
Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex': Rules & subrules not known to be previously run:
pdflatex
Rule 'pdflatex': The following rules & subrules became out-of-date:
'pdflatex'
------------
Run number 1 of rule 'pdflatex'
------------
------------
Running 'pdflatex -file-line-error --max-print-line=10000 -recorder -output-directory="cache" "test1.tex"'
------------
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (MiKTeX 2.9.6400)
entering extended mode
(test1.tex
LaTeX2e <2017-04-15>
Babel <3.12> and hyphenation patterns for 76 language(s) loaded.
(D:UserDocumentslatextexmfsinstalltexlatexmemoirmemoir.cls
Document Class: memoir 2016/05/16 v3.7f configurable book, report, article document class
(D:UserDocumentslatextexmfsinstalltexgenericoberdiekifpdf.sty) (D:UserDocumentslatextexmfsinstalltexlatexifetexifetex.sty (D:UserDocumentslatextexmfsinstalltexplainifetexifetex.tex)) (D:UserDocumentslatextexmfsinstalltexgenericifxetexifxetex.sty) (D:UserDocumentslatextexmfsinstalltexgenericoberdiekifluatex.sty) (D:UserDocumentslatextexmfsinstalltexlatexmemoirmem10.clo) (D:UserDocumentslatextexmfsinstalltexlatexmemoirmempatch.sty)) English YES!
Brazil NO!
Turkish NO!
test1.tex:15: Undefined control sequence
test1.tex:15: Undefined control sequence
(D:Testcachetest1.aux) [1D:/User/Documents/latex/texmfs/data/pdftex/config/pdftex.map] (D:Testcachetest1.aux) )
(see the transcript file for additional information)<D:/User/Documents/latex/texmfs/install/fonts/type1/public/amsfonts/cm/cmbx12.pfb><D:/User/Documents/latex/texmfs/install/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on D:Testcachetest1.pdf (1 page, 21716 bytes).
Transcript written on D:Testcachetest1.log.
=== TeX engine is 'pdfTeX'
Latexmk: Log file says output to 'cache/test1.pdf'
Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex': File changes, etc:
Changed files, or newly in use since previous run(s):
'cache/test1.aux'
------------
Run number 2 of rule 'pdflatex'
------------
------------
Running 'pdflatex -file-line-error --max-print-line=10000 -recorder -output-directory="cache" "test1.tex"'
------------
This is pdfTeX, Version 3.14159265-2.6-1.40.18 (MiKTeX 2.9.6400)
entering extended mode
(test1.tex
LaTeX2e <2017-04-15>
Babel <3.12> and hyphenation patterns for 76 language(s) loaded.
(D:UserDocumentslatextexmfsinstalltexlatexmemoirmemoir.cls
Document Class: memoir 2016/05/16 v3.7f configurable book, report, article document class
(D:UserDocumentslatextexmfsinstalltexgenericoberdiekifpdf.sty) (D:UserDocumentslatextexmfsinstalltexlatexifetexifetex.sty (D:UserDocumentslatextexmfsinstalltexplainifetexifetex.tex)) (D:UserDocumentslatextexmfsinstalltexgenericifxetexifxetex.sty) (D:UserDocumentslatextexmfsinstalltexgenericoberdiekifluatex.sty) (D:UserDocumentslatextexmfsinstalltexlatexmemoirmem10.clo) (D:UserDocumentslatextexmfsinstalltexlatexmemoirmempatch.sty)) English YES!
Brazil NO!
Turkish NO!
test1.tex:15: Undefined control sequence
test1.tex:15: Undefined control sequence
(D:Testcachetest1.aux) [1D:/User/Documents/latex/texmfs/data/pdftex/config/pdftex.map] (D:Testcachetest1.aux) )
(see the transcript file for additional information)<D:/User/Documents/latex/texmfs/install/fonts/type1/public/amsfonts/cm/cmbx12.pfb><D:/User/Documents/latex/texmfs/install/fonts/type1/public/amsfonts/cm/cmr10.pfb>
Output written on D:Testcachetest1.pdf (1 page, 21716 bytes).
Transcript written on D:Testcachetest1.log.
=== TeX engine is 'pdfTeX'
Latexmk: Log file says output to 'cache/test1.pdf'
Latexmk: Errors, in force_mode: so I tried finishing targets
Collected error summary (may duplicate other messages):
pdflatex: Command for 'pdflatex' gave return code 1
Refer to 'cache/test1.log' for details
Latexmk: Undoing directory change


Why latex does not tell which command is not defined? Does it hurt him? Is he afraid it is too much information and I cannot handle it by myself???



Is there some fix I can apply to latex, so it starts telling me which commands is not defined when there is some error?



References:



  1. http://tex.stackexchange.com/questions/228936/setting-entries-of-list-of-listings-in-latex-package-listings

  2. Test if a package (or package option) is loaded






errors pdftex miktex latexmk compilation-error





share












share










share



share










asked 8 mins ago









useruser

1,28821030




1,28821030












  • I do not understand the behavior of latexmk but pdflatex tells me addto is undefined.

    – Symbol 1
    2 mins ago

















  • I do not understand the behavior of latexmk but pdflatex tells me addto is undefined.

    – Symbol 1
    2 mins ago
















I do not understand the behavior of latexmk but pdflatex tells me addto is undefined.

– Symbol 1
2 mins ago





I do not understand the behavior of latexmk but pdflatex tells me addto is undefined.

– Symbol 1
2 mins ago










0






active

oldest

votes












Your Answer








StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "85"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f485830%2fwhy-latex-does-not-tell-me-which-command-is-undefined%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f485830%2fwhy-latex-does-not-tell-me-which-command-is-undefined%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Isabella Eugénie Boyer Biographie | Références | Menu de navigationmodifiermodifier le codeComparator to Compute the Relative Value of a U.S. Dollar Amount – 1774 to Present.

Lioubotyn Sommaire Géographie | Histoire | Population | Notes et références | Liens externes | Menu de navigationlubotin.kharkov.uamodifier« Recensements et estimations de la population depuis 1897 »« Office des statistiques d'Ukraine : population au 1er janvier 2010, 2011 et 2012 »« Office des statistiques d'Ukraine : population au 1er janvier 2011, 2012 et 2013 »Informations officiellesCartes topographiquesCarte routièrem

Mpande kaSenzangakhona Biographie | Références | Menu de navigationmodifierMpande kaSenzangakhonavoir la liste des auteursm