emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Option that prevents Org to add \lstset{language=⟨language⟩,...} when co


From: Denis Bitouzé
Subject: Option that prevents Org to add \lstset{language=⟨language⟩,...} when code blocks are exported to LaTeX
Date: Sat, 26 Feb 2022 18:27:28 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)

Hi,

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.

Sometimes, you want the ~listings~ package to have some global settings
that are overridden by this ~\lstset{...}~ added by Org. Typically, you
may define some dialects ⟨dialect1⟩, ..., ⟨dialectN⟩ of a given
⟨language⟩ and you want to load them in addition to the (main)
⟨language⟩. This can be done by the following global setting:

  ┌────
  │ \lstset{
  │     language=⟨language⟩,
  │     alsolanguage=[⟨dialect1⟩]⟨language⟩,
  │     ...
  │     alsolanguage=[⟨dialectN⟩]⟨language⟩,
  │ }
  └────

Unfortunately, it is overridden by each ~\lstset{...}~ added by Org.

So would it be possible to provide an option that prevents Org to add
these systematic:

  ┌────
  │ \lstset{language=⟨language⟩,label= ,caption= ,captionpos=b,numbers=none}
  └────

Thanks!
-- 
Denis

reply via email to

[Prev in Thread] Current Thread [Next in Thread]