7

I'm trying to have LaTeX examples in a document. I use the showexpl package which lets me use the listings package options. Because all fragments are short, line numbers are redundant.

The following MWE does not yield the result I want (i.e. there is a line number).

\documentclass{article}

\usepackage{showexpl}
\lstset{numbers=none}

\begin{document}
\begin{LTXexample}
Hello World!
\end{LTXexample}
\end{document}

When I define the option local(\begin{LTXexample}[numbers=none]) the number is gone. I would rather delete them globally and not have to type extra code for every example, so using a new style would preferably be avoided.

I think the solution will be somewhat like this.

0

1 Answer 1

5

This works for me:

\documentclass{article}

\usepackage{showexpl}
\lstset{explpreset={numbers=none}}

\begin{document}
\begin{LTXexample}
Hello World!
\end{LTXexample}
\end{document}

You can read about the ęxplpreset parameter here.

Update: if you specify explpreset={} the result will be the same (because this is the default)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .