3

escapeinside=|| usually works but not inside what for my programming language (SAS) is a string:

\documentclass[a4paper,12pt]{book}
\usepackage{minted}
\usemintedstyle{vs}
\newcommand{\sasinline}[1]{\mintinline{sas}{#1}}
\newenvironment{sas}{\VerbatimEnvironment
  \begin{minted}[escapeinside=||]{sas}}
 {\end{minted}}

\begin{document} 

Is it possible to write \emph{percorso fisico} in italics here?
\begin{sas}
libname <|\emph{nome logico}|> '<|\emph{percorso fisico}|>' <|\emph{eventuali opzioni}|>;
\end{sas}

Leaving this as is:
\begin{sas}
libname corso '/projects/corsosas';
\end{sas}

\end{document}

enter image description here

  • From the minted manual: “Escaping does not work inside strings and comments” – egreg Aug 2 '17 at 16:58
  • @egreg ... but David found a solution, anyway :) – CarLaTeX Aug 2 '17 at 18:05
  • You can improve the solution by doing \newcommand{\metastring}[1]{\PYG{l+s}{\PYGZsq{}<}\PYG{l+s}{\emph{#1}}\PYG{l+s}{>\PYGZsq{}}} and using |\metastring{percorso fisico}|. – egreg Aug 3 '17 at 10:14
  • @egreg Already done, of course! The only difference is that I called it \sasstringemph :) – CarLaTeX Aug 3 '17 at 10:28
4

An answer I know you will want to accept:

enter image description here

\documentclass[a4paper,12pt]{book}
\usepackage{minted}
\usemintedstyle{vs}
\newcommand{\sasinline}[1]{\mintinline{sas}{#1}}
\newenvironment{sas}{\VerbatimEnvironment
  \begin{minted}[escapeinside=||]{sas}}
 {\end{minted}}

\begin{document} 

Is it possible to write \emph{percorso fisico} in italics here?
\begin{sas}
libname <|\emph{nome logico}|> |\PYG{l+s}{\PYGZsq{}<}\PYG{l+s}{\emph{pineapple pizza}}\PYG{l+s}{>\PYGZsq{}}| <|\emph{eventuali opzioni}|>;
\end{sas}

Leaving this as is:
\begin{sas}
libname corso '/projects/corsosas';
\end{sas}

\end{document}
  • "Pineapple pizza" will become the new "ducks" for vote-attraction! :-) – CarLaTeX Aug 2 '17 at 16:02

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.