emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Christian Moe <mail@christianmoe.com>
To: jman <emacs-orgmode@city17.xyz>
Cc: emacs-orgmode@gnu.org
Subject: Re: Understanding Publish (ox-publish.el)
Date: Mon, 14 Oct 2024 10:37:59 +0200	[thread overview]
Message-ID: <87jzeb9ixl.fsf@christianmoe.com> (raw)
In-Reply-To: <871q0j3iv2.fsf@city17.xyz>


Hi,

The default document class is article.

1. First issue:

Not quite sure what you mean by saying that it "does not handle content
exceeding the page length". If the problem is with placing images,
tables etc., latex does its best, and manually adding \clearpage or
\newpage as needed tends to be the way it's done.

If what you want is automatic page breaks before every section and
subsection, you can try this trick at the beginning of the document:

  #+latex: \AddToHook{cmd/section/before}{\clearpage}
  #+latex: \AddToHook{cmd/subsection/before}{\clearpage}

(This only kicks in after the table of contents; if you want a page break
before the ToC as well, replace #+latex with #+latex_header.)

If you have an old latex installation, the above may not work. Try this instead:

  #+latex: \let\oldsection\section\renewcommand\section{\clearpage\oldsection}
  #+latex: \let\oldsubsection\subsection\renewcommand\subsection{\clearpage\oldsubsection}

2. Second issue: Getting rid of link borders.

To use hidelinks without options clashing, try this:

  #+latex_class_options: [hidelinks]

However, if you just want the ugly borders gone but would prefer the
links to stand out, you can instead customize the variable
org-latex-hyperref-template by adding `colorlinks=true'. You can play with
the color options as well; to get you started:

(setq org-latex-hyperref-template 
   "\\hypersetup{\n pdfauthor={%a},\n pdftitle={%t},\n
pdfkeywords={%k},\n pdfsubject={%d},\n pdfcreator={%c},\n
pdflang={%L},\n colorlinks=true,\n urlcolor=blue,\n linkcolor=blue\n,
citecolor=green}")


Yours,
Christian


jman <emacs-orgmode@city17.xyz> writes:

> Hello,
>
> I'm trying to learn more about the publish export option or Org mode. Specifically I am using the 
> function `org-latex-publish-to-pdf` to export Orgmode files into PDF.
>
> Since this export backend is transparently using Latex, there is stuff going on behind my back that 
> makes it a bit difficult debugging or customizing the formatting.
>
> My header in the Orgmode file started as simple as:
>
>   #+TITLE: Title of the document
>   #+OPTIONS: toc:nil date:nil author:nil
>
>   #+latex_header: \usepackage[a4paper,top=4cm,bottom=4cm]{geometry}
>
> The Orgmode file is nothing but a long ordered list of items:
>
>   * Title
>   ** Subtitle
>   (Lots of text)
>   ** Subtlte II
>   * Title II
>   (Lots of text)
>   ... more ...
>
> and so on. After compiling to PDF, I learn that the default "template" (how is it called in Latex 
> lingo? `\documentclass`?) used by `org-latex-publish-to-pdf` does not handle content exceeding the 
> page length so I have to manually add some page breaks, clearly a hack:
>
>   * Title
>   ** Subtitle
>   (Lots of text)
>
>   #+latex: \clearpage
>   ** Subtlte II
>
>   #+latex: \clearpage
>   * Title II
>
>   (Lots of text)
>   ... more ...
>
> Why isn't this handled automatically for me? Is there a setting I should add in the org file? What's 
> the default template used by `org-latex-publish-to-pdf`?
>
> Second issue: I want hyperlinks to other documents to not have a border. On Latex the solution seems 
> to use the hyperref package:
>
>   +latex_header: \usepackage[hidelinks]{hyperref}
>
> again, compiling triggers this error:
>
>   ! LaTeX Error: Option clash for package hyperref.
>
> This error hints at some defaults I cannot see, making the document customization difficult. Where 
> are these defaults?
>
> How can I get a feeling of what's happening when using this PDF publish option? I think I need a bit 
> of a high-level overview, hope the author David O’Toole is around for some support :-)
>
> Ideally I'm looking into a simple way to export from Orgmode to PDF, without needing to learn Latex.
>
> Thank you for suggestions, ideas, etc.
>
> Best,



  reply	other threads:[~2024-10-14  9:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-13 19:25 Understanding Publish (ox-publish.el) jman
2024-10-14  8:37 ` Christian Moe [this message]
2024-10-14 15:40   ` jman
2024-10-14 18:47     ` jman
2024-10-14 21:06       ` Christian Moe
2024-10-15  7:13         ` jman
2024-10-15  8:11           ` Christian Moe
2024-10-15 11:54             ` Rens Oliemans
2024-10-20 13:04         ` Ihor Radchenko
2024-10-21  7:07           ` Christian Moe
2024-10-26 17:38             ` Ihor Radchenko
2024-10-14 10:02 ` Dr. Arne Babenhauserheide

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=87jzeb9ixl.fsf@christianmoe.com \
    --to=mail@christianmoe.com \
    --cc=emacs-orgmode@city17.xyz \
    --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).