[Tex/LaTex] \lstset{numbers=none} not working

listingsshowexpl

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.

Best Answer

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)

Related Question