3

I've run into a weird issue related to footnotes.

When I compile the document I pasted below, the "regular" #import statement is shown exactly as it appears in the source code. However, when I use the exact same bit of text in the footnote, an additional # is inserted with no apparent reason, causing "##import" to be shown in the produced document.

Can someone enlighten me as to what is going on here?

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{minted}
\usemintedstyle[glsl]{colorful}
\usemintedstyle[c]{colorful}
\usemintedstyle[cpp]{colorful}
\usemintedstyle[bash]{colorful}

\title{mintedtest}
\author{Me}
\date{August 2018}

\begin{document}

\maketitle

\section{Introduction}

Some text \mintinline{c}{#include something} More text \footnote{Some text \mintinline{c}{#include something} More text}

\end{document}
  • 4
    Fn 1. of the documentation: For example, \mintinline works in footnotes! The main exception is when the code contains the percent % or hash # characters, or unmatched curly braces. – Alan Munn Aug 16 '18 at 15:53
  • Use \# to typeset an octothorpe, not a bare # (which is a special character to TeX). (Edit: Maybe I don't understand how \mintinline works. @AlanMunn seems better informed.) – Harald Hanche-Olsen Aug 16 '18 at 15:53
  • 1
    @HaraldHanche-Olsen Escaping the character doesn't work. The result in my case becomes "\#include" – Bartvbl Aug 16 '18 at 15:55
  • @AlanMunn Well, I guess that explains it. – Bartvbl Aug 16 '18 at 15:55
  • Yes, I see that now. (See my update on the comment you responded to. I really had no idea what the minted package does. Sorry about the noise.) – Harald Hanche-Olsen Aug 16 '18 at 15:56
3

This is a known limitation of the \mintinline command which is mentioned in Fn 1 of the documentation:

For example, \mintinline works in footnotes! The main exception is when the code contains the percent % or hash # characters, or unmatched curly braces.

Since the minted authors are clearly aware of it, I suspect it's not an issue that they are planning to solve.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.