0

I need to compile with this string (this question is related to this other):

latex '\AtBeginDocument{\newcounter{MyFootnote} \let\MyOldFootnote\footnote \renewcommand{\footnote}[1]{\stepcounter{MyFootnote}\label{FootnoteMark\arabic{MyFootnote}}\MyOldFootnote{\label{FootnoteText\arabic{MyFootnote}}#1}}} \input{myfile.tex}'

(I'm sorry but I don't know hot to diplay it in a more readeble way...)

But it would be better if I could use latexmk instead. I tried:

latexmk -latex="\AtBeginDocument{\newcounter{MyFootnote} \let\MyOldFootnote\footnote \renewcommand{\footnote}[1]{\stepcounter{MyFootnote}\label{FootnoteMark\arabic{MyFootnote}}\MyOldFootnote{\label{FootnoteText\arabic{MyFootnote}}#1}}}" myfile.tex

but it doesn't work.

Here's a MWE:

\begin{document}

\setcounter{section}{4}

\section{Section}

Some dummy text.\footnote{Some dummy text.}

\end{document}
Gabriele
  • 1,815
  • you probably need to quote more characters but wouldn't it be easier to just use latexmk on a file myfile.abc where myfile.abc is \AtBeginDocument{\newcounter{MyFootnote} \let\MyOldFootnote\footnote \renewcommand{\footnote}[1]{\stepcounter{MyFootnote}\label{FootnoteMark\arabic{MyFootnote}}\MyOldFootnote{\label{FootnoteText\arabic{MyFootnote}}#1}}}\input{myfile.tex} ? – David Carlisle Jul 22 '17 at 09:42
  • @DavidCarlisle I tried latexmk myfile.abc as you suggested... but it does not work. – Gabriele Jul 22 '17 at 10:25
  • Why not make a latexmkrc file that redefines the $latex command? – Herb Schulz Jul 22 '17 at 16:07
  • @HerbSchulz Honestly I have no idea how to do that. – Gabriele Jul 22 '17 at 20:04
  • Please read the latexmk documentation. Run texdoc latemk for TeX Live. – Herb Schulz Jul 22 '17 at 22:19
  • @HerbSchulz Thank you. I learned a lot reading the latexmk documentation. I think that for my purposes it is better to run the latex command 2 times as I know that this will generate the correct aux file. I suppose that latexmk in this case is a bit overkill (see the related post). – Gabriele Jul 23 '17 at 08:34

0 Answers0