New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List items starting with brackets broken in LaTeX output #414

Closed
RyanKoppenhaver-NCC opened this Issue Feb 24, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@RyanKoppenhaver-NCC

RyanKoppenhaver-NCC commented Feb 24, 2017

For the markdown input:

* \[foo\] bar

...kramdown generates this LaTeX output:

\begin{itemize}
\item [foo] bar
\end{itemize}

LaTeX then processes [foo] as an optional parameter to \item, specifying the bullet point symbol. (The intervening whitespace is ignored.) This results in output that looks like this:

 | Lorem ipsum dolor sit amet
 |
 | * asdf
 foo bar
 | * blah

The issue also applies to ordered lists, and to input where the brackets are not escaped, but kramdown can't find a corresponding link definition, so it passes the brackets through. It's possible other LaTex output has similar issues, but I haven't looked in depth.

Based on some messing around, I think this can be fixed by inserting an empty group {} or a \relax command into the output after \item, or by transforming the leading [ into either {[} or \char91 . I kind of like the first option, but I'm by no means a TeX/LaTeX expert, so I'm not sure if another one might be more technically correct.

@gettalong gettalong self-assigned this Feb 24, 2017

@gettalong gettalong added the bug label Feb 24, 2017

@gettalong

This comment has been minimized.

Owner

gettalong commented Feb 24, 2017

There are already many places in kramdown's LaTeX converter that use {} because of the way LaTeX is parsed. So this is probably the way to go - I will have a look.

Thanks for reporting this bug!

@gettalong

This comment has been minimized.

Owner

gettalong commented Sep 3, 2017

@RyanKoppenhaver-NCC I have looked at this and putting {} after \item would fix it for this case. However, during my experiments I found other problems with brackets and so they will additionally be escaped using {[} and {]}.

This is fixed in the next release.

@gettalong gettalong closed this Sep 3, 2017

gettalong added a commit that referenced this issue Sep 3, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment