Options in listings package

52 views
Skip to first unread message

Stephen Taylor

unread,
Mar 28, 2023, 10:56:59 AM3/28/23
to LaTeX Users Group
This minimal file using the listings package to display code reports an error: Couldn't load requested aspect. Removing the options (as in the commented-out line) removes the problem. The option is as documented in 4.3.9 of the package documentation

\documentclass{article}
% \usepackage{keyval} % makes no difference
\usepackage[xleftmargin=1em]{listings}
% \usepackage{listings} % works

\begin{document}
\lstset{language=}

\begin{lstlisting}

It is a privilege to learn a language
A journey into the immediate

-- Marilyn Hacker

\end{lstlisting}
\end{document}

Logfile attached. Can you see what is causing my problem?

SJT


listings.log

Gildas Cotomale

unread,
Mar 28, 2023, 11:47:56 AM3/28/23
to LaTeX Users Group
Hello Stephen,

I can't see this option in 2.2 of latest package documentation.
Also, 2.3 stats that the key=value interface is used by lstset
Options in 4.3.9 are to use with the environement (or lstset if you want to do it once)

\usepackage{listings}
\begin{document}
\lstset{xleftmargin=1em,language=}
\begin{lstlisting}

It is a privilege to learn a language
A journey into the immediate

-- Marilyn Hacker

\end{lstlisting}
\end{document}

Regards

Stephen Taylor

unread,
Mar 31, 2023, 11:49:45 AM3/31/23
to LaTeX Users Group
Tx. Using \lstset does the job. I had wrongly understood from LaTeX Users’ Guide that any option could be set through \usepackage
Reply all
Reply to author
Forward
0 new messages