Reputation: 1476
I'm trying to produce a very clean latex code for an article submission using knitr. One of the guidelines is to not define new commands. However right now a simple markdown list uses it by default.
This minimal .Rmd
---
title: "Untitled"
output:
pdf_document:
keep_tex: yes
---
1. First
1. Second
Produces this .tex output
\begin{document}
\maketitle
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\item
First
\item
Second
\end{enumerate}
\end{document}
Is there a way to not put the \def\labelenumi{\arabic{enumi}.
line?
(I know I can write latex code right into the Rmd document, but it's very tedious and I rather deal with markdown as much as I can. )
Upvotes: 2
Views: 225
Reputation: 1476
I found a way to circumvent the issue by using #.
instead of 1.
. I'm not entirely sure why, but
#. First
#. Second
Produces de desired output
\begin{enumerate}
\item
First
\item
Second
\end{enumerate}
Is not ideal, but good enough!
Upvotes: 2
Reputation: 22599
Pandoc has no built-in way of removing this. It could be argued that it ought not to be a problem, as the above \def
only sets the value of an existing variable instead of defining a new command; but the journal might disagree.
The easiest way to get rid of this would be to manually post-process the output. I.e., use a tool like sed
or the search-and-replace functionality of your favorite editor.
sed -i -e '/^\\def.*/d' your-article.latex
An automated, but complex approach would be to do list rendering via a pandoc filter. However, that seems like more trouble than it's worth in this case.
Upvotes: 2