emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Edgar Lux <edgarlux@mailfence.com>
To: Emacs Orgmode <emacs-orgmode@gnu.org>
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)	[thread overview]
Message-ID: <1568206205.356863.1692096813061@fidget.co-bxl> (raw)
In-Reply-To: <530944580.355360.1692095755367@fidget.co-bxl>

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


  reply	other threads:[~2023-08-15 10:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-15 10:35 How to preserve indentation of title inside a latex src block when exporting to LaTeX? Edgar Lux
2023-08-15 10:53 ` Edgar Lux [this message]
2023-08-16 10:05 ` Ihor Radchenko
     [not found]   ` <1821743348.485583.1692187548513@fidget.co-bxl>
2023-08-16 12:14     ` 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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  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=1568206205.356863.1692096813061@fidget.co-bxl \
    --to=edgarlux@mailfence.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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).