[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Option that prevents Org to add \lstset{language=⟨language⟩,...} whe
From: |
Denis Bitouzé |
Subject: |
Re: Option that prevents Org to add \lstset{language=⟨language⟩,...} when code blocks are exported to LaTeX |
Date: |
Tue, 18 Oct 2022 09:32:05 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) |
Le 18/10/22 à 04h14, Ihor Radchenko a écrit :
> Denis Bitouzé <denis.bitouze@univ-littoral.fr> writes:
>
>> here is a feature request about the LaTeX export.
>>
>> With ~(setq org-latex-listings t)~, code blocks such as:
>>
>> ┌────
>> │ #+BEGIN_SRC ⟨language⟩ :exports code
>> │ ...
>> │ #+END_SRC
>> └────
>>
>> are exported to LaTeX into:
>>
>> ┌────
>> │ \lstset{language=⟨language⟩,label= ,caption= ,captionpos=b,numbers=none}
>> │ \begin{lstlisting}
>> │ ...
>> │ \end{lstlisting}
>> └────
>>
>> But the:
>>
>> ┌────
>> │ \lstset{language=⟨language⟩,label= ,caption= ,captionpos=b,numbers=none}
>> └────
>>
>> systematically added before each of the ~lstlisting~ LaTeX environments
>> is not always desirable and let me explain why.
>
> Confirmed.
> Is there a way to apply \lstset locally for the environment?
It is enough to put it in a group:
┌────
│ \bgroup
│ \lstset{...}
│ \begin{lstlisting}
│ ...
│ \end{lstlisting}
│ \egroup
└────
Otherwise, all the options specified by `\lstset` can be applied as an
option of the `lstlisting` environment:
┌────
│ \begin{lstlisting}[language=⟨language⟩,...]
└────
--
Denis