pandoc icon indicating copy to clipboard operation
pandoc copied to clipboard

Nice references to latex items

Open catap opened this issue 4 years ago • 8 comments

Let me share a small example of latex code:

\documentclass[a4paper, DIV=15]{scrartcl}

\usepackage{enumitem}

\begin{document}

Some text
\begin{enumerate}[label={(\alph*)}]
  \item\label{item1} Some item;
  \item Another item;
  \item An item that has references to Item~\ref{item1}.
\end{enumerate}

\end{document}

which is compiled to very nice pdf: Screenshot 2021-05-22 at 19 16 22

Unfortunately when I compiled it to .docx I have this wired things: Screenshot 2021-05-22 at 19 17 08

And markdown version looks same to .docx:

Some text

1.  [\[item1\]]{#item1 label="item1"} Some item;

2.  Another item;

3.  An item that has references to
    Item [\[item1\]](#item1){reference-type="ref" reference="item1"}.

Is it possible to add a magic option to achive output at docx similar with nice pdf?

I'm using:

pandoc 2.13
Compiled with pandoc-types 1.22, texmath 0.12.2, skylighting 0.10.5,
citeproc 0.3.0.9, ipynb 0.1.0.1
User data directory: /Users/catap/.local/share/pandoc
Copyright (C) 2006-2021 John MacFarlane. Web:  https://pandoc.org
This is free software; see the source for copying conditions. There is no
warranty, not even for merchantability or fitness for a particular purpose.

catap avatar May 22 '21 17:05 catap

Slightly related issues: #813 and #1774.

tarleb avatar May 23 '21 16:05 tarleb

We wouldn't need to make an option for this; it should ideally just be done by default. It shouldn't be too hard to implement.

jgm avatar May 23 '21 17:05 jgm

Note also that in your example the list style information ([label={(\alph*)}]) is being lost.

jgm avatar May 23 '21 17:05 jgm

@jgm yeah, double bug! :)

catap avatar May 23 '21 18:05 catap

Hello @jgm! I'm using Pandoc to convert Latex to html and I'm having the same issue. The following latex:

\begin{enumerate}
\item[(E1)] First
\item[(E2)] Second
\end{enumerate}

Outputs the following html:

<ol>
    <li><p>First</p></li>
    <li><p>Second</p></li>
</ol>

Is this still unresolved?

I could try and fix it if you think this is a good first issue.

wilitp avatar Jun 06 '24 23:06 wilitp

if you think this is a good first issue.

Definitely not. The Pandoc AST has no way to represent a list with arbitrary markers.

jgm avatar Jun 06 '24 23:06 jgm

I see. Is there any workaround I could try? Thanks

wilitp avatar Jun 06 '24 23:06 wilitp

@wilitp Your question should better be asked in Discussions. It is not really relevant to this issue, which has to do with references to list items, not list items with custom enumerators.

jgm avatar Jun 07 '24 17:06 jgm