TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I it possible to use minted for inline code and to add a short verb sing for minted? Like \lstMakeShortInline| in listings.sty?

\documentclass{article}

\usepackage{minted}
   \newminted{tex}{}
   \newmint[ltx]{tex}{}

\begin{document}
Normal Text \ltx|\inline \Verb \not \inline|
\begin{texcode}
\Display \verbatim
\end{texcode}
Normal Text %|\not \working|
\end{document}
share|improve this question
up vote 9 down vote accepted

minted supports this since v2.0 (on CTAN since 2015/01/31):

inline code

\documentclass{article}

\usepackage{minted}

\begin{document}
  You can use \mintinline{latex}{\mintinline{latex}{your $code$ goes here}} of
  the minted~2 package to highlight source code inline. If you already use
  \mintinline{latex}{\usepackage{minted}}
\end{document}

It is also possible to add a short verb sign:

from the Dokumentation:

\newmintinline['macro name']{'language'}{'options'}. If a 'macro name' is not specified, then the created macro is called \'language'inline

short inline

share|improve this answer
1  
Welcome to TeX.SX! It's nice that you can confirm this: maybe you can show an example about how it works for demonstration. – Claudio Fiandrino Dec 5 '13 at 11:10
    
Thanks that sounds good. Do you know if something like \lstMakeShortInline| is available (or planned) too? – Tobi Dec 5 '13 at 16:23
    
Now I do ... :) – YAK Dec 5 '13 at 17:11
2  
@Tobi I intentionally didn’t build this into minted (and neither did Geoffrey, presumably for the same reason) because it’s incredibly bad design in my opinion. LaTeX already has too many “magic” (active) characters, no need to add even more. If anything, users of TeX should disable active characters and math delimiters in general code. – Konrad Rudolph Dec 5 '13 at 18:48
1  
Adding to @YAK's answer (I don't have enough reputation to comment on it directly), minted v2.0 was released with the \mintinline feature to CTAN on 2015/01/31 and v2.1 on 2015/09/09 according to its readme (page 28). Ubuntu 15.10 includes minted v2.0 in the texlive-latex-extra package (version 2015.20150810-1). – Michael Mandel Feb 3 at 16:44

So far there is no support for inline code since I (mistakenly, in hindsight) deemed this not important.

If I find some time to work on the next release, support for this may be added (and will probably break backwards compatibility). In the meantime, somebody has posted a patch (be sure to read all the comments!) to make the \mint command inline. You may want to play with that.

share|improve this answer
1  
Thank you. I read it and decided to use listings for inline and mint for displayed code. I accept your answer but I still hope that there is a official solution in a future version :-) – Tobi Feb 25 '12 at 22:43
    
How do I install a patch? Im running OS X 10.6. – Tobi Feb 26 '12 at 0:13
    
Hi Konrad, I also read that Allow inline code thread but that was old stuff and I'm not sure if the solution sketched there still applies. pygments seems also to be stuck in 2008 with version 1.4 – green diod Mar 4 '13 at 18:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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