emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: pinmacs@cas.cat
To: emacs-orgmode@gnu.org
Subject: ox-latex: help: LATEX_HEADER from different subtrees collision
Date: Tue, 3 Sep 2024 00:09:59 +0200	[thread overview]
Message-ID: <f4ec557e-9f77-4099-98d3-a9b4c505c366@cas.cat> (raw)


[-- Attachment #1.1.1: Type: text/plain, Size: 1663 bytes --]

Hi,

** The context

I found a way to export subtrees to PDF and I liked that idea a lot, I
use it, for example, to generate with an org-capture an invoice, and
export to PDF, etc.

The invoice is part of my journal.

My journal is structured for the whole year (year, week, day). That
file has a lot of lines: 3247 the active 2024, and 179487 the archived
2024; the archived part is out of the org-agenda).

Then I wanted to add a weekly report, which extracts some properties
of some entries, generates some tables, and I wanted to be exported
them to PDF in the same way.

** The problem

I discovered that the LATEX_HEADER of a different subtree produce
collisions, when I discovered this I felt weird, because
~org-latex-export-to-pdf~ docstring says that it respects the
narrowing or the region [1], but I can reproduce how this is not
true. Or let me know what I am doing wrong, if LATEX_HEADER is buffer
scope (which would make sense), then, what is the equivalent in case
you want to specify a LATEX_HEADER in subtree scope

Find attached a file (ox-latex-problem.org) that produce [2] a clash
of latex headers [3], particularly, with geometry (landscape vs
portrait). That if you comment one or the other, it applies to the
whole buffer. Can you modify that file to make it work? Or is it a bug
on ox-latex?

Thanks for your attention,
pinmacs

[1]
If narrowing is active in the current buffer, only export its
narrowed part.

If a region is active, export that region.

[2] ~emacs -Q~ with orgmode 9.7.10 part of emacs-30 branch with commit 
44c2614

[3] ! LaTeX Error: Option clash for package geometry.

[-- Attachment #1.1.2: ox-latex-problem.org --]
[-- Type: text/org, Size: 1670 bytes --]

* ox-latex-problem
** [2024-09-02 Mon]
*** report #1 (landscape)
:PROPERTIES:
:EXPORT_LANGUAGE: en
:EXPORT_TITLE:
:EXPORT_SUBTITLE:
:EXPORT_AUTHOR:
:EXPORT_DATE:
:EXPORT_OPTIONS: toc:nil timestamp:nil num:nil
:EXPORT_TOC: headlines 2
:EXPORT_FILE_NAME: /tmp/report2.pdf
:CLICK_TO_SEE_REPORT: file:/tmp/report2.pdf
:END:

#+name: sourceblock_created_2024-09-02_23-36-05
#+begin_src emacs-lisp :exports none :results none
(defun my/export-pdf ()
  "renders the PDF"
  (org-narrow-to-subtree)
  (org-show-subtree)

  (org-latex-export-to-pdf nil t t nil)

  (widen)
)
(my/export-pdf)
#+end_src

# if you uncomment this, both reports are in landscape
#+LATEX_HEADER: \usepackage[a4paper, landscape, margin=0.5cm]{geometry}

**** My report #2

***** Introduction

Introduction text

***** The report #2

Report #2 text

***** Conclusions

Conclusions text

** [2024-09-01 Sun]

*** report #2 (portrait)
:PROPERTIES:
:EXPORT_LANGUAGE: ca
:EXPORT_TITLE:
:EXPORT_SUBTITLE:
:EXPORT_AUTHOR:
:EXPORT_DATE:
:EXPORT_OPTIONS: toc:nil timestamp:nil num:nil
:EXPORT_TOC: headlines 2
:EXPORT_FILE_NAME: /tmp/report1.pdf
:CLICK_TO_SEE_REPORT: file:/tmp/report1.pdf
:END:

#+name: sourceblock_created_2024-09-02_23-36-07
#+begin_src emacs-lisp :exports none :results none
(defun my/export-pdf ()
  "renders the PDF"
  (org-narrow-to-subtree)
  (org-show-subtree)

  (org-latex-export-to-pdf nil t t nil)

  (widen)
)
(my/export-pdf)
#+end_src

# if you uncomment this, both reports are in portrait
#+LATEX_HEADER: \usepackage[a4paper, margin=3cm]{geometry}

**** My report #1

***** Introduction

Introduction text

***** The report #1

Report #1 text

***** Conclusions

Conclusions text

[-- Attachment #1.1.3: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3323 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

             reply	other threads:[~2024-09-02 22:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-02 22:09 pinmacs [this message]
2024-09-03 22:50 ` ox-latex: help: LATEX_HEADER from different subtrees collision Rudolf Adamkovič
2024-09-04 10:21   ` Pedro
2024-09-04 13:24     ` pinmacs
2024-09-04 17:28     ` Rudolf Adamkovič

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=f4ec557e-9f77-4099-98d3-a9b4c505c366@cas.cat \
    --to=pinmacs@cas.cat \
    --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).