abntex / abntex2

:books: Classe LaTeX e estilo bibliográfico compatíveis com as normas da ABNT
http://www.abntex.net.br
LaTeX Project Public License v1.3c
1.03k stars 219 forks source link

toc: Argument of \MakeUppercase (arg 1) has an extra } #259

Open denilsonsa opened 1 year ago

denilsonsa commented 1 year ago

Estou tentando migrar minha monografia do antigo pacote abnt versão 1 para o novo abntex2. Infelizmente, estou tento problemas com o table-of-contents. O código-fonte está disponível no GitHub, e versão experimental está na branch abntex2.

Ao tentar compilar, recebo o seguinte erro:

(./mouse_magnetometro_monografia.toc
./mouse_magnetometro_monografia.toc:10: Argument of \MakeUppercase (arg 1) has 
an extra }.
<inserted text> 
                \par 
l.10 ...Uppercase []{Introdução}}{11}{chapter.1}
                                                  % 

Olhando o arquivo .toc, vejo isto:

…
\contentsline {chapter}{\chapternumberline {1}\MakeUppercase []{Introdução}}{11}{chapter.1}%
\contentsline {section}{\numberline {1.1}Motivação e objetivos}{12}{section.1.1}%
…

Olhando esse mesmo arquivo .toc, mas usando a versão antiga abnt, consigo observar que \MakeUppercase não é utilizado:

…
\contentsline {chapter}{\numberline {1}Introdução}{1}{chapter.listoffigures.1}%
\contentsline {section}{\numberline {1.1}Motivação e objetivos}{2}{section.listoffigures.1.1}%
…

Não tenho experiência suficiente com LaTeX/TeX, e não sei o que está errado.

Passos para reprodução do problema

git clone https://github.com/denilsonsa/atmega8-magnetometer-usb-mouse.git
cd atmega8-magnetometer-usb-mouse/monografia
git checkout abntex2
make

Sistema

rdg-bzr commented 1 year ago

Olá,

Estou tendo o mesmo problema. Ao compilar o arquivo no meu pc, o arquivo .toc vem com essas chaves adicionais:

\contentsline {chapter}{\chapternumberline {1}\MakeUppercase []{Introdução}}{35}{chapter.1}%

Quando rodo o mesmo arquivo no overleaf, isso não acontece:

\contentsline {chapter}{\chapternumberline {1}\MakeUppercase {Introdução}}{33}{chapter.1}%

Nesse último caso, o arquivo é criado corretamente

Você já conseguiu chegar a alguma solução?

denilsonsa commented 1 year ago

Consegui um arquivo mínimo que reproduz o problema:

\documentclass{abntex2}

\usepackage{microtype}

\begin{document}

\tableofcontents

\chapter{Introdução}

\end{document}

Remover o pacote microtype faz o erro desaparecer.

Se eu tentar comparar os logs do Overleaf com os logs locais da minha máquina:

Package Overleaf Manjaro difference
pdfTeX 3.141592653-2.6-1.40.24 (TeX Live 2022) 3.141592653-2.6-1.40.25 (TeX Live 2023/Arch Linux) Newer minor version
LaTeX2e 2022-06-01 patch level 5 2022-11-01 patch level 1 5 months newer
L3 programming layer 2022-08-05 2023-02-22 6 months newer
abntex2 2018/11/24 v-1.9.7 abnTeX2 abntex2 2018/11/24 v-1.9.7 abnTeX2 same
ifthen 2022/04/13 v1.1d 2022/04/13 v1.1d same
memoir 2022/07/29 v3.7r 2022/11/17 v3.7.19 4 months newer
etoolbox 2020/10/05 v2.5k 2020/10/05 v2.5k same
iftex 2022/02/03 v1.0f 2022/02/03 v1.0f same
array 2022/03/10 v2.5f 2022/09/04 v2.5g 6 months newer
dcolumn 2014/10/28 v1.06 2014/10/28 v1.06 same
delarray 2014/10/28 v1.01 2014/10/28 v1.01 same
tabularx 2020/01/15 v2.11c 2020/01/15 v2.11c same
textcase 2022/07/10 v1.03 2022/07/10 v1.03 same
hyperref 2022-06-13 v7.00r 2023-02-07 v7.00v 8 months newer
ltxcmds 2020-05-10 v1.25 2020-05-10 v1.25 same
pdftexcmds 2020-06-27 v0.33 2020-06-27 v0.33 same
infwarerr 2019/12/03 v1.5 2019/12/03 v1.5 same
keyval 2022/05/29 v1.15 2022/05/29 v1.15 same
kvsetkeys 2019/12/15 v1.18 2022-10-05 v1.19 3 years newer
kvdefinekeys 2019-12-19 v1.6 2019-12-19 v1.6 same
pdfescape 2019/12/09 v1.15 2019/12/09 v1.15 same
hycolor 2020-01-27 v1.10 2020-01-27 v1.10 same
letltxmacro 2019/12/03 v1.6 2019/12/03 v1.6 same
auxhook 2019-12-17 v1.6 2019-12-17 v1.6 same
nameref 2022-05-17 v2.50 2022-05-17 v2.50 same
refcount 2019/12/15 v3.6 2019/12/15 v3.6 same
gettitlestring 2019/12/15 v1.6 2019/12/15 v1.6 same
kvoptions 2020-10-07 v3.14 2022-06-15 v3.15 2 years newer
pd1enc.def 2022-06-13 v7.00r 2023-02-07 v7.00v 8 months newer
intcalc 2019/12/15 v1.3 2019/12/15 v1.3 same
etexcmds 2019/12/15 v1.7 2019/12/15 v1.7 same
puenc.def 2022-06-13 v7.00r 2023-02-07 v7.00v 8 months newer
url 2013/09/16 ver 3.4 2013/09/16 ver 3.4 same
bitset 2019/12/09 v1.3 2019/12/09 v1.3 same
bigintcalc 2019/12/15 v1.5 2019/12/15 v1.5 same
atbegshi-ltx 2021/01/10 v1.0c 2021/01/10 v1.0c same
hpdftex.def 2022-06-13 v7.00r 2023-02-07 v7.00v 8 months newer
atveryend-ltx 2020/08/19 v1.0a 2020/08/19 v1.0a same
rerunfilecheck 2019/12/05 v1.9 2022-07-10 v1.10 3 years newer
uniquecounter 2019/12/15 v1.4 2019/12/15 v1.4 same
memhfixc 2021/06/16 v1.19 2022/11/17 v1.20 1½ year newer
bookmark 2020-11-06 v1.29 2020-11-06 v1.29 same
bkm-pdftex.def 2020-11-06 v1.29 2020-11-06 v1.29 same
babel 2022/07/20 3.78 2023/02/13 3.86 7 months newer
Language: portuges 2021/07/09 v1.2t 2021/07/09 v1.2t same
enumitem 2019/06/20 v3.9 2019/06/20 v3.9 same
calc 2017/05/25 v4.3 2017/05/25 v4.3 same
microtype 2022/06/23 v3.0f 2023/03/13 v3.1a 9 months newer
microtype-pdftex.def 2022/06/23 v3.0f 2023/03/13 v3.1a 9 months newer
microtype.cfg 2022/06/23 v3.0f 2023/03/13 v3.1a 9 months newer
l3backend-pdftex.def 2022-08-05 2023-01-16 5 months newer
mt-cmr.cfg 2013/05/19 v2.2 2013/05/19 v2.2 same

Notei que uma linha existe no log da minha máquina, mas não existe no log do Overleaf:

Package microtype Info: Applying patch `verbatim' on input line 5.

Não sei se é relevante.

Overleaf log (last few lines) ``` ) (./output.aux) \openout1 = `output.aux'. LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 5. LaTeX Font Info: ... okay on input line 5. LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 5. LaTeX Font Info: ... okay on input line 5. LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 5. LaTeX Font Info: ... okay on input line 5. LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 5. LaTeX Font Info: ... okay on input line 5. LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 5. LaTeX Font Info: ... okay on input line 5. LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 5. LaTeX Font Info: ... okay on input line 5. LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 5. LaTeX Font Info: ... okay on input line 5. LaTeX Font Info: Checking defaults for PD1/pdf/m/n on input line 5. LaTeX Font Info: ... okay on input line 5. LaTeX Font Info: Checking defaults for PU/pdf/m/n on input line 5. LaTeX Font Info: ... okay on input line 5. Package hyperref Info: Link coloring OFF on input line 5. \myptabbox=\box59 \myptabboxwidth=\skip259 LaTeX Info: Redefining \microtypecontext on input line 5. Package microtype Info: Applying patch `item' on input line 5. Package microtype Info: Applying patch `toc' on input line 5. Package microtype Info: Applying patch `eqnum' on input line 5. Package microtype Info: Applying patch `footnote' on input line 5. Package microtype Info: Generating PDF output. Package microtype Info: Character protrusion enabled (level 2). Package microtype Info: Using default protrusion set `alltext'. Package microtype Info: Automatic font expansion enabled (level 2), (microtype) stretch: 20, shrink: 20, step: 1, non-selected. Package microtype Info: Using default expansion set `alltext-nott'. LaTeX Info: Redefining \showhyphens on input line 5. Package microtype Info: No adjustment of tracking. Package microtype Info: No adjustment of interword spacing. Package microtype Info: No adjustment of character kerning. (/usr/share/texmf-dist/tex/latex/microtype/mt-cmr.cfg File: mt-cmr.cfg 2013/05/19 v2.2 microtype config. file: Computer Modern Roman (RS) ) Package microtype Info: Loading generic protrusion settings for font family (microtype) `cmss' (encoding: OT1). (microtype) For optimal results, create family-specific settings. (microtype) See the microtype manual for details. (./output.toc LaTeX Font Info: External font `cmex10' loaded for size (Font) <7> on input line 3. LaTeX Font Info: External font `cmex10' loaded for size (Font) <5> on input line 3. ) [1 {/usr/share/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] [2 ] [3] \tf@toc=\write4 \openout4 = `output.toc'. (./output.aux) ) ```
Manjaro log (last few lines) ``` ) (./output.aux) \openout1 = `output.aux'. LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 5. LaTeX Font Info: ... okay on input line 5. LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 5. LaTeX Font Info: ... okay on input line 5. LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 5. LaTeX Font Info: ... okay on input line 5. LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 5. LaTeX Font Info: ... okay on input line 5. LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 5. LaTeX Font Info: ... okay on input line 5. LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 5. LaTeX Font Info: ... okay on input line 5. LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 5. LaTeX Font Info: ... okay on input line 5. LaTeX Font Info: Checking defaults for PD1/pdf/m/n on input line 5. LaTeX Font Info: ... okay on input line 5. LaTeX Font Info: Checking defaults for PU/pdf/m/n on input line 5. LaTeX Font Info: ... okay on input line 5. Package hyperref Info: Link coloring OFF on input line 5. \myptabbox=\box59 \myptabboxwidth=\skip258 LaTeX Info: Redefining \microtypecontext on input line 5. Package microtype Info: Applying patch `item' on input line 5. Package microtype Info: Applying patch `toc' on input line 5. Package microtype Info: Applying patch `eqnum' on input line 5. Package microtype Info: Applying patch `footnote' on input line 5. Package microtype Info: Applying patch `verbatim' on input line 5. Package microtype Info: Generating PDF output. Package microtype Info: Character protrusion enabled (level 2). Package microtype Info: Using default protrusion set `alltext'. Package microtype Info: Automatic font expansion enabled (level 2), (microtype) stretch: 20, shrink: 20, step: 1, non-selected. Package microtype Info: Using default expansion set `alltext-nott'. LaTeX Info: Redefining \showhyphens on input line 5. Package microtype Info: No adjustment of tracking. Package microtype Info: No adjustment of interword spacing. Package microtype Info: No adjustment of character kerning. (/usr/share/texmf-dist/tex/latex/microtype/mt-cmr.cfg File: mt-cmr.cfg 2013/05/19 v2.2 microtype config. file: Computer Modern Roman (RS) ) Package microtype Info: Loading generic protrusion settings for font family (microtype) `cmss' (encoding: OT1). (microtype) For optimal results, create family-specific settings. (microtype) See the microtype manual for details. (./output.toc LaTeX Font Info: External font `cmex10' loaded for size (Font) <7> on input line 3. LaTeX Font Info: External font `cmex10' loaded for size (Font) <5> on input line 3. ./output.toc:6: Argument of \MakeUppercase (arg 1) has an extra }. \par l.6 ...keUppercase []{Introdução}}{3}{chapter.1} % … ./output.toc:6: ==> Fatal error occurred, no output PDF file produced! ```

Além disso, o arquivo .toc é diferente: a versão local possui o [] adicional, enquanto a versão no Overleaf não possui.

Overleaf toc ``` \changetocdepth {4} \babel@toc {brazil}{}\relax \contentsline {chapter}{Sum\'ario}{1}{section*.1}% \setlength {\cftchapterindent }{\cftlastnumwidth } \setlength {\cftchapternumwidth }{2em} \setlength {\cftchapterindent }{0em} \setlength {\cftchapternumwidth }{\cftlastnumwidth } \contentsline {chapter}{\chapternumberline {1}\MakeUppercase {Introdução}}{3}{chapter.1}% ```
Manjaro toc ``` \changetocdepth {4} \babel@toc {brazil}{}\relax \contentsline {chapter}{Sum\'ario}{1}{section*.1}% \setlength {\cftchapterindent }{\cftlastnumwidth } \setlength {\cftchapternumwidth }{2em} \setlength {\cftchapterindent }{0em} \setlength {\cftchapternumwidth }{\cftlastnumwidth } \contentsline {chapter}{\chapternumberline {1}\MakeUppercase []{Introdução}}{3}{chapter.1}% ```

Espero que essa investigação ajude a encontrar o bug.

denilsonsa commented 1 year ago

My investigation leads to believe the issue lies within microtype package. Indeed, there is an open issue over there: \MakeUppercase in toc breaks microtype with latex 2022+ #29

Indeed, the old abnt package didn't include \MakeUppercase in .toc, but the newer abntex2 includes it, and that breaks when used together with microtype package in newer LaTeX versions.

It's apparently fixed in their dev branch, but not yet pushed to any release. I think I'm gonna poke them, kindly asking them to release a new version.