Skip to content
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

The \mintinline command will generate error when used in \chapter{} #29

Closed
moihn opened this issue Apr 24, 2014 · 3 comments
Closed

The \mintinline command will generate error when used in \chapter{} #29

moihn opened this issue Apr 24, 2014 · 3 comments
Labels

Comments

@moihn
Copy link

moihn commented Apr 24, 2014

If I wrote code as:

\chapter{The \mintinline{cpp}{std::cout}}

and compile with:

xelatex -shell-escape book.tex

An error of :

Error: no lexer for alias 'CPP' found.

I used \tracingall in \mintinline implementation and found that something like:

\chapter -> \uppercase{**** \mint {cpp}{std::cout}}

is expanded.

So I think the \uppercase in \chapter expansion may have changed the "cpp" to uppercase.

I tried to update the \mintinline implementation, adding \lowercase{} to the \def\mint@lang{#2} code, but without success.

@moihn
Copy link
Author

moihn commented Apr 24, 2014

More information: It seems the \uppercase is used in rendering the page's header area, where all strings are displayed in uppercase.

@gpoore
Copy link
Owner

gpoore commented Apr 24, 2014

I think this is due to a common problem: verbatim content often doesn't behave in the arguments to commands. If that's the case (I will have to investigate a bit further), there may be no solution, only workarounds.

A standard way to get verbatim content into command arguments is to use a savebox. For example,

\newsavebox\mybox
\begin{lrbox}{\mybox}
\mintinline{cpp}{std::cout}
\end{lrbox}

\section{Text \usebox{\mybox}}

@gpoore
Copy link
Owner

gpoore commented Jul 23, 2014

I've done some further investigation, and don't have any additional suggestions. I would be interested to see a minimal example document that exhibits the problem, since I'm not getting it with the book document class. Maybe you are using a special document class?

I've added a section in the FAQ in the documentation that addresses this sort of situation. Since I don't believe there is anything else I can do, at least without more information, I'm closing the issue for now.

@gpoore gpoore closed this as completed Jul 23, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants