New answers tagged


As @Werner mentioned in his comment, you could use tabsize to adjust the indentation if you are using tabs in your source code. However, a more robust solution, that works for both tabs and spaces, is to use the formats feature of listings package. It allows you to define custom formatting rules. For your case, something as simple as the following suffices: ...


Not sure what's the usefulness of this: \begin{filecontents*}{\jobname-test.tex} \LaTeX \end{filecontents*} \documentclass{article} \usepackage{minted,catchfile} \newcommand\inputmintinline[3][]{% \begingroup\everyeof{}% \CatchFileDef\temp{#3}{}% \scantokens\expandafter{% \expandafter\processinputmintinline\expandafter{\temp}{#1}{#2}% }\unskip ...


For those who are interested for a listings scrolling window environment. I wrapped the AlexGs' code scroll commands into a new listings environment called codescroll. All you have to do it to provide the environment with: Listing options [optional] A unique xsavebox id The number of the lines of your code The view-port height in lines of code The ...


You can use xparse verbatim arguments for that. \documentclass{scrartcl} \usepackage{amsmath,xparse} \NewDocumentCommand\codeExample{v}{% Code: \texttt{#1} yields \scantokens{#1\noexpand}% } \begin{document} \codeExample{$\lVert a\rVert$} \end{document}

Top 50 recent answers are included