zestedesavoir / zmarkdown

Live demo: https://zestedesavoir.github.io/zmarkdown/
MIT License
226 stars 53 forks source link

Footnotes in title break the PDF build #461

Closed philippemilink closed 2 years ago

philippemilink commented 2 years ago

If you create a content with a title with a footnote, the produced LaTeX cannot be built.

For instance, the following input:

En C++, il existe une structure de données permettant de regrouper plusieurs données en un seul bloc. Dans leur grande originalité, elle s'appelle… **structure**. :)

[[information | Point de vocabulaire]]
| À partir de maintenant, j'emploierai le terme « structure » pour désigner l'agrégat que nous allons introduire et l'expression « structure de données » pour désigner les formes complexes de données de manière générale.

Les structures sont très utiles pour regrouper des données qui ont un lien entre elles et travailler dessus de manière uniforme, et non sur chaque donnée séparément. Voyons un exemple concret avec un petit exercice.

# Stockage d'informations personnelles[^grpd] #

[^grpd]: En total accord avec le RGPD.
*[GRPD]: Règlement Européen pour la Protection des Données 

Essayez de créer un programme qui demande des informations sur une personne et les stocke dans un fichier `Prenom.Nom.csv` sous le format suivant.

(from https://zestedesavoir.com/tutoriels/822/la-programmation-en-c-moderne/decoupons-tout-ca/de-nouvelles-structures-de-donnees/#1-struct-un-agregat-de-donnees)

Produces the following error in the LaTeX compilation log:

[...]
Package hyperref Warning: Token not allowed in a PDF string (Unicode):
(hyperref)                removing `\@ifnextchar' on input line 35.

! Illegal parameter number in definition of \reserved@a.
<to be read again> 
1
l.35 ...sonnelles\textsuperscript{\footnotemark[1]}}

You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.

! Extra \else.
\H@old@sect ...}{\@currenttocentry }\fi \fi \else 
                                                  \def \@svsechd {#6{\nobrea...
l.35 ...sonnelles\textsuperscript{\footnotemark[1]}}

I'm ignoring this; it doesn't match any \if.

! Undefined control sequence.
\H@old@sect ...ntry }\fi \fi \else \def \@svsechd 
                                                  {#6{\nobreak \sectioncatch...
l.35 ...sonnelles\textsuperscript{\footnotemark[1]}}

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

! Illegal parameter number in definition of \reserved@a.
<to be read again> 
1
l.35 ...sonnelles\textsuperscript{\footnotemark[1]}}

You meant to type ## instead of #, right?
Or maybe a } was forgotten somewhere earlier, and things
are all screwed up? I'm going to assume that you meant ##.

)
! Incomplete \iffalse; all text was ignored after line 35.
<inserted text> 
\fi 
<*> ...lding/extra_contents/test-bug-export-pdf-c.tex

The file ended while I was skipping conditional text.
This kind of error happens when you say `\if...' and forget
the matching `\fi'. I've inserted a `\fi'; this might work.

! Emergency stop.
<*> ...lding/extra_contents/test-bug-export-pdf-c.tex

*** (job aborted, no legal \end found)
StaloneLab commented 2 years ago

Funny that this was supposed to be fixed by issue #400 . The \protect is not added before \footnotemark, causing the error. I will investigate why later.