[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to preserve indentation of title inside a latex src block when e
From: |
Edgar Lux |
Subject: |
Re: How to preserve indentation of title inside a latex src block when exporting to LaTeX? |
Date: |
Tue, 15 Aug 2023 12:53:33 +0200 (CEST) |
This didn't work (I tried)
;; Indent title ----
(defun my-latex-filter-indent-title (text backend info)
"Ensure \"\\title\" is indented in LaTeX export."
(when (org-export-derived-backend-p backend 'latex)
(replace-regexp-in-string
;; (rx (group (and (syntax escape) "title")))
;; (rx (and " " (backref 1))) text)))
"title"
" title" text)))
(make-local-variable 'org-export-filter-plain-text-functions)
(add-to-list 'org-export-filter-plain-text-functions
'my-latex-filter-indent-title)
;; ---- indent title ends
On Aug 15, 2023 at 12:35 PM, Edgar Lux <edgarlux@mailfence.com> wrote:Hello.
How to preserve indentation of title inside a latex src block when
exporting to LaTeX?
For (annoying) reasons, I need a frontmatter block which is able to indent its
contents. I am almost there, but the title line is not. I can edit this
manually after export, but I would like to know if there is a way to do this...
wait... there are filters. Is a filter the only solution? Thanks.
#+options: toc:nil title:nil timestamp:nil
#+begin_src emacs-lisp
(org-babel-do-load-languages
'org-babel-load-languages
'( (latex . t) ))
#+end_src
#+begin_frontmatter
#+begin_src latex -i :exports results :eval yes :results replace
\title{Determine in-situ matrix properties}
\nothing{a}
#+end_src
#+end_frontmatter
#+caption: Notice that title is not indented, but nothing is.
#+results:
: \begin{frontmatter}
: \title{Determine in-situ matrix properties}
: \nothing{a}
: \end{frontmatter}
#+begin_src emacs-lisp
(concat (emacs-version) "\n" (org-version))
#+end_src
#+RESULTS:
: GNU Emacs 28.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.36, cairo
version 1.17.6)
: of 2023-01-03
: 9.5.5
--
Sent with https://mailfence.com
Secure and private email
--
Sent with https://mailfence.com
Secure and private email