emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Denis Bitouzé" <denis.bitouze@univ-littoral.fr>
To: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <87zgmda67z.fsf@example.com> (raw)


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}


             reply	other threads:[~2022-02-26 17:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-26 17:27 Denis Bitouzé [this message]
2022-10-18  4:14 ` Option that prevents Org to add \lstset{language=⟨language⟩,...} when code blocks are exported to LaTeX Ihor Radchenko
2022-10-18  7:32   ` Denis Bitouzé
2022-10-18  8:11     ` Ihor Radchenko
2022-10-31  8:19       ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zgmda67z.fsf@example.com \
    --to=denis.bitouze@univ-littoral.fr \
    --cc=emacs-orgmode@gnu.org \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).