[-- Attachment #1: Type: text/plain, Size: 1424 bytes --] Hi, I'm using org-mode mainly to generate LaTEX (both documents and presentations). I'd like to know if there is any way to flag that the contents of an EXAMPLE block should be passed RAW to LaTEX. I need this to be able to include my colouring commands in some listings, which otherwise break because some things like '...' are translated to \ldots, etc. An example: #+ATTR_LATEX: :options [fontsize=\small,frame=single,commandchars=\\!|] #+BEGIN_verbatim \GreenLst!student@juju|:~$ sudo usermod -aG lxd $(whoami) student@juju:~$ newgrp lxd student@juju:~$ lxd init --auto student@juju:~$ lxc network set lxdbr0 ipv6.address none #+END_verbatim Translates into: \begin{verbatim}[fontsize=\small,frame=single,commandchars=\\!|] \GreenLst!student@juju|:\textasciitilde{}\$ sudo usermod -aG lxd \((whoami) student@juju:~\) newgrp lxd student@juju:\textasciitilde{}\$ lxd init --auto student@juju:\textasciitilde{}\$ lxc network set lxdbr0 ipv6.address none \end{verbatim} Where \((whoami) is obviously wrong. Emacs 28.0.92 built yesterday. GNU Emacs 28.0.92 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0) of 2022-03-23 Thanks a ton, /PA -- Fragen sind nicht da um beantwortet zu werden, Fragen sind da um gestellt zu werden Georg Kreisler Headaches with a Juju log: unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run a leader-deposed hook here, but we can't yet [-- Attachment #2: Type: text/html, Size: 2151 bytes --]
I'm not sure but maybe you want to use a src block, #+begin_src latex :exports results ... #+end_src ? I am not entirely clear how you wish org to know what is "raw" and what is "LaTeX". -- : Eric S Fraga, with org release_9.5.2-420-g971eb6 in Emacs 29.0.50
On 29/03/2022 20:12, Eric S Fraga wrote: > I'm not sure but maybe you want to use a src block, > > #+begin_src latex :exports results > ... > #+end_src > > ? I am not entirely clear how you wish org to know what is "raw" and > what is "LaTeX". If LaTeX is the only export target then a more simple way exists: #+begin_export latex any arbitrary LaTeX code #+end_export info "(org) Quoting LaTeX code" https://orgmode.org/manual/Quoting-LaTeX-code.html
On Tuesday, 29 Mar 2022 at 21:44, Max Nikulin wrote:
> If LaTeX is the only export target then a more simple way exists:
>
> #+begin_export latex
Yes, of course!
--
: Eric S Fraga, with org release_9.5.2-420-g971eb6 in Emacs 29.0.50
[-- Attachment #1: Type: text/plain, Size: 1333 bytes --] Hi Eric, Thanks for answering :-) I'm currently solving the issue with #+BEGIN_export LaTeX \begin{verbatim}[commandchars=\\\{\}] student@juju:~$ \textbf{sudo bootstrap-juju.sh} \end{verbatim} #+END_export What I was wondering is whether we could have something like: #+ATTR_LATEX :raw t :attributes [commandchars=\\\{\}] #+BEGIN_verbatim student@juju:~$ \textbf{sudo bootstrap-juju.sh} #+END_verbatim With that ":raw t" the text between the BEGIN_ and END_ would not go through the protecttexttt function. (of course, without the :raw t everything would work as today). Again, it's just because it would be a cleaner to read. I have an yasnippet in place, so it wouldn't actually mean more or less typing. Best, /PA On Tue, 29 Mar 2022 at 15:12, Eric S Fraga <e.fraga@ucl.ac.uk> wrote: > I'm not sure but maybe you want to use a src block, > > #+begin_src latex :exports results > ... > #+end_src > > ? I am not entirely clear how you wish org to know what is "raw" and > what is "LaTeX". > > -- > : Eric S Fraga, with org release_9.5.2-420-g971eb6 in Emacs 29.0.50 > -- Fragen sind nicht da um beantwortet zu werden, Fragen sind da um gestellt zu werden Georg Kreisler Headaches with a Juju log: unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run a leader-deposed hook here, but we can't yet [-- Attachment #2: Type: text/html, Size: 2332 bytes --]
On 30/03/2022 12:14, Pedro Andres Aranda Gutierrez wrote: > > Thanks for answering :-) I'm currently solving the issue with > > #+BEGIN_export LaTeX > \begin{verbatim}[commandchars=\\\{\}] > student@juju:~$ \textbf{sudo bootstrap-juju.sh} > \end{verbatim} > #+END_export > > What I was wondering is whether we could have something like: > > #+ATTR_LATEX :raw t :attributes [commandchars=\\\{\}] > #+BEGIN_verbatim > student@juju:~$ \textbf{sudo bootstrap-juju.sh} > #+END_verbatim I think, it is better to add :attributes parameter support to #+begin_example block. It may be added to org, for a while you can use a custom derived backend. See info "(org) Advanced Export Configuration" https://orgmode.org/manual/Advanced-Export-Configuration.html You need to define an example-block filter, current implementation is https://git.savannah.gnu.org/cgit/emacs/org-mode.git/tree/lisp/ox-latex.el#n1853 I never tried it but perhaps it is possible to customize the listings LaTeX package for automatic highlighting of text after shell prompt. In Org #+begin_src blocks may use lstlisting environment.