Take the 2-minute tour ×
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.

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

2 Answers 2

up vote 7 down vote accepted

Geoffrey Poore develops minted further and answered in this similar tex.SE Question:

This is not supported in the current release (minted 1.7). There is a \mintinline command in the development version at https://github.com/gpoore/minted. The development version is currently at 2.0-alpha2, but based on my own use and reports from others, it should be quite stable.

And I can confirm this:

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}} just download
  github.com/gpoore/minted/blob/master/source/minted.sty to your project
  directory.
\end{document}

I hope Poore will release it to CPAN soon.


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
    
Thanks but thats not really what I meant. In the above example a short verb would be like X|my $foo = $bar;|X, i.e. only delimited by the pipes … –  Tobi Dec 5 '13 at 17:43
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

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.