Why latex does not tell me which command is undefined? Announcing the arrival of Valued...

What would you call this weird metallic apparatus that allows you to lift people?

Why complex landing gears are used instead of simple,reliability and light weight muscle wire or shape memory alloys?

RSA find public exponent

What adaptations would allow standard fantasy dwarves to survive in the desert?

Random body shuffle every night—can we still function?

The Nth Gryphon Number

Printing attributes of selection in ArcPy?

What does Turing mean by this statement?

Getting out of while loop on console

A term for a woman complaining about things/begging in a cute/childish way

Moving a wrapfig vertically to encroach partially on a subsection title

How many time has Arya actually used Needle?

Relating to the President and obstruction, were Mueller's conclusions preordained?

What is the difference between CTSS and ITS?

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

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

Resize vertical bars (absolute-value symbols)

Would color changing eyes affect vision?

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

Sally's older brother

Positioning dot before text in math mode

How to force a browser when connecting to a specific domain to be https only using only the client machine?

Why are vacuum tubes still used in amateur radios?

Is there public access to the Meteor Crater in Arizona?



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 loaded












0















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



PassOptionsToPackage{main=brazil,english,spanish,french}{babel}

documentclass[
10pt,
a5paper,
]{memoir}

makeatletter
@ifpackagewith{babel}{english}{message{English YES!^^J}}{message{English NO!^^J}}
@ifpackagewith{babel}{brazil}{message{Brazil YES!^^J}}{message{Brazil NO!^^J}}
@ifpackagewith{babel}{turkish}{message{Turkish YES!^^J}}{message{Turkish NO!^^J}}

@ifpackagewith{babel}{brazil}{addtocaptionsbrazil{renewcommand{lstlistingname}{Código}}}{}
@ifpackagewith{babel}{english}{addtocaptionsenglish{renewcommand{lstlistingname}{Code}}}{}
makeatother

begin{document}
chapter{Introduction}
Thing.
end{document}


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
@ifpackageloaded{babel}{@ifpackagewith{babel}{english}{message{English YES!^^J}}{message{English NO!^^J}}}{}
@ifpackageloaded{babel}{@ifpackagewith{babel}{brazil}{message{Brazil YES!^^J}}{message{Brazil NO!^^J}}}{}
@ifpackageloaded{babel}{@ifpackagewith{babel}{turkish}{message{Turkish YES!^^J}}{message{Turkish NO!^^J}}}{}

@ifpackageloaded{babel}{@ifpackagewith{babel}{brazil}{addtocaptionsbrazil{renewcommand{lstlistingname}{Código}}}{}}{}
@ifpackageloaded{babel}{@ifpackagewith{babel}{english}{addtocaptionsenglish{renewcommand{lstlistingname}{Code}}}{}}{}
makeatother


Or just load the babel package with RequirePackage{babel}.





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
@ifpackagewith{babel}{english}{message{English YES!^^J}}{message{English NO!^^J}}
@ifpackagewith{babel}{brazil}{message{Brazil YES!^^J}}{message{Brazil NO!^^J}}
@ifpackagewith{babel}{turkish}{message{Turkish YES!^^J}}{message{Turkish NO!^^J}}

@ifpackagewith{babel}{brazil}{addtocaptionsbrazil{}}{}
@ifpackagewith{babel}{english}{addtocaptionsenglish{}}{}
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) [1{D:/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) [1{D:/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



























    0















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



    PassOptionsToPackage{main=brazil,english,spanish,french}{babel}

    documentclass[
    10pt,
    a5paper,
    ]{memoir}

    makeatletter
    @ifpackagewith{babel}{english}{message{English YES!^^J}}{message{English NO!^^J}}
    @ifpackagewith{babel}{brazil}{message{Brazil YES!^^J}}{message{Brazil NO!^^J}}
    @ifpackagewith{babel}{turkish}{message{Turkish YES!^^J}}{message{Turkish NO!^^J}}

    @ifpackagewith{babel}{brazil}{addtocaptionsbrazil{renewcommand{lstlistingname}{Código}}}{}
    @ifpackagewith{babel}{english}{addtocaptionsenglish{renewcommand{lstlistingname}{Code}}}{}
    makeatother

    begin{document}
    chapter{Introduction}
    Thing.
    end{document}


    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
    @ifpackageloaded{babel}{@ifpackagewith{babel}{english}{message{English YES!^^J}}{message{English NO!^^J}}}{}
    @ifpackageloaded{babel}{@ifpackagewith{babel}{brazil}{message{Brazil YES!^^J}}{message{Brazil NO!^^J}}}{}
    @ifpackageloaded{babel}{@ifpackagewith{babel}{turkish}{message{Turkish YES!^^J}}{message{Turkish NO!^^J}}}{}

    @ifpackageloaded{babel}{@ifpackagewith{babel}{brazil}{addtocaptionsbrazil{renewcommand{lstlistingname}{Código}}}{}}{}
    @ifpackageloaded{babel}{@ifpackagewith{babel}{english}{addtocaptionsenglish{renewcommand{lstlistingname}{Code}}}{}}{}
    makeatother


    Or just load the babel package with RequirePackage{babel}.





    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
    @ifpackagewith{babel}{english}{message{English YES!^^J}}{message{English NO!^^J}}
    @ifpackagewith{babel}{brazil}{message{Brazil YES!^^J}}{message{Brazil NO!^^J}}
    @ifpackagewith{babel}{turkish}{message{Turkish YES!^^J}}{message{Turkish NO!^^J}}

    @ifpackagewith{babel}{brazil}{addtocaptionsbrazil{}}{}
    @ifpackagewith{babel}{english}{addtocaptionsenglish{}}{}
    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) [1{D:/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) [1{D:/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

























      0












      0








      0








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



      PassOptionsToPackage{main=brazil,english,spanish,french}{babel}

      documentclass[
      10pt,
      a5paper,
      ]{memoir}

      makeatletter
      @ifpackagewith{babel}{english}{message{English YES!^^J}}{message{English NO!^^J}}
      @ifpackagewith{babel}{brazil}{message{Brazil YES!^^J}}{message{Brazil NO!^^J}}
      @ifpackagewith{babel}{turkish}{message{Turkish YES!^^J}}{message{Turkish NO!^^J}}

      @ifpackagewith{babel}{brazil}{addtocaptionsbrazil{renewcommand{lstlistingname}{Código}}}{}
      @ifpackagewith{babel}{english}{addtocaptionsenglish{renewcommand{lstlistingname}{Code}}}{}
      makeatother

      begin{document}
      chapter{Introduction}
      Thing.
      end{document}


      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
      @ifpackageloaded{babel}{@ifpackagewith{babel}{english}{message{English YES!^^J}}{message{English NO!^^J}}}{}
      @ifpackageloaded{babel}{@ifpackagewith{babel}{brazil}{message{Brazil YES!^^J}}{message{Brazil NO!^^J}}}{}
      @ifpackageloaded{babel}{@ifpackagewith{babel}{turkish}{message{Turkish YES!^^J}}{message{Turkish NO!^^J}}}{}

      @ifpackageloaded{babel}{@ifpackagewith{babel}{brazil}{addtocaptionsbrazil{renewcommand{lstlistingname}{Código}}}{}}{}
      @ifpackageloaded{babel}{@ifpackagewith{babel}{english}{addtocaptionsenglish{renewcommand{lstlistingname}{Code}}}{}}{}
      makeatother


      Or just load the babel package with RequirePackage{babel}.





      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
      @ifpackagewith{babel}{english}{message{English YES!^^J}}{message{English NO!^^J}}
      @ifpackagewith{babel}{brazil}{message{Brazil YES!^^J}}{message{Brazil NO!^^J}}
      @ifpackagewith{babel}{turkish}{message{Turkish YES!^^J}}{message{Turkish NO!^^J}}

      @ifpackagewith{babel}{brazil}{addtocaptionsbrazil{}}{}
      @ifpackagewith{babel}{english}{addtocaptionsenglish{}}{}
      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) [1{D:/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) [1{D:/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:



      PassOptionsToPackage{main=brazil,english,spanish,french}{babel}

      documentclass[
      10pt,
      a5paper,
      ]{memoir}

      makeatletter
      @ifpackagewith{babel}{english}{message{English YES!^^J}}{message{English NO!^^J}}
      @ifpackagewith{babel}{brazil}{message{Brazil YES!^^J}}{message{Brazil NO!^^J}}
      @ifpackagewith{babel}{turkish}{message{Turkish YES!^^J}}{message{Turkish NO!^^J}}

      @ifpackagewith{babel}{brazil}{addtocaptionsbrazil{renewcommand{lstlistingname}{Código}}}{}
      @ifpackagewith{babel}{english}{addtocaptionsenglish{renewcommand{lstlistingname}{Code}}}{}
      makeatother

      begin{document}
      chapter{Introduction}
      Thing.
      end{document}


      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
      @ifpackageloaded{babel}{@ifpackagewith{babel}{english}{message{English YES!^^J}}{message{English NO!^^J}}}{}
      @ifpackageloaded{babel}{@ifpackagewith{babel}{brazil}{message{Brazil YES!^^J}}{message{Brazil NO!^^J}}}{}
      @ifpackageloaded{babel}{@ifpackagewith{babel}{turkish}{message{Turkish YES!^^J}}{message{Turkish NO!^^J}}}{}

      @ifpackageloaded{babel}{@ifpackagewith{babel}{brazil}{addtocaptionsbrazil{renewcommand{lstlistingname}{Código}}}{}}{}
      @ifpackageloaded{babel}{@ifpackagewith{babel}{english}{addtocaptionsenglish{renewcommand{lstlistingname}{Code}}}{}}{}
      makeatother


      Or just load the babel package with RequirePackage{babel}.





      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
      @ifpackagewith{babel}{english}{message{English YES!^^J}}{message{English NO!^^J}}
      @ifpackagewith{babel}{brazil}{message{Brazil YES!^^J}}{message{Brazil NO!^^J}}
      @ifpackagewith{babel}{turkish}{message{Turkish YES!^^J}}{message{Turkish NO!^^J}}

      @ifpackagewith{babel}{brazil}{addtocaptionsbrazil{}}{}
      @ifpackagewith{babel}{english}{addtocaptionsenglish{}}{}
      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) [1{D:/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) [1{D:/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 3 mins ago









      useruser

      1,28821030




      1,28821030






















          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

          El tren de la libertad Índice Antecedentes "Porque yo decido" Desarrollo de la...

          Puerta de Hutt Referencias Enlaces externos Menú de navegación15°58′00″S 5°42′00″O /...

          Castillo d'Acher Características Menú de navegación