Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom export template to use with ox-pandoc #43

Open
zenny opened this issue Nov 9, 2024 · 2 comments
Open

Custom export template to use with ox-pandoc #43

zenny opened this issue Nov 9, 2024 · 2 comments

Comments

@zenny
Copy link

zenny commented Nov 9, 2024

Hi,

ox-pandoc made the export a breeze, but I could not figure out how to customize the look of the outpug. I tried with both scimax (https://github.com/jkitchin/scimax) and ews (https://github.com/pprevos/emacs-writing-studio), but ox-pandoc seems to override the org-export classes which comes built-in with those configs?

Appreciate if someone can throw some light on. Fyi, I have posted a query to jkitchin/scimax#509, too.

Cheers, and have a nice weekend,
/zenny

@a-fent
Copy link
Collaborator

a-fent commented Nov 11, 2024

Hi, I'm not familiar with those packages but at a glance I'm guessing they provide Latex templates for Org Mode's exporter.

If you are using ox-pandoc, you need to use Pandoc's templating system instead to change the look and feel of your output. You can pass your options to Pandoc from within your Org document.

For example, if you have a pandoc templates called "scimax.tex" (saved, by default, in ~/.pandoc/templates/) you can tell ox-pandoc to use this template by adding the header #+pandoc_options: template:scimax.tex to your document.

Does this help?

@zenny
Copy link
Author

zenny commented Nov 12, 2024

Hi, I'm not familiar with those packages

Fyi, they are not packages, but emacs-configs for specific purposes, scimax is for technical writing and the ews is for the general-purpose writing without experiencing 'emacs-bankruptcy'. ;-)

but at a glance I'm guessing they provide Latex templates for Org Mode's exporter.
Yes they do have, but could not figure out exactly how to implement the styles and fonts to produce consistent-looking documents!

If you are using ox-pandoc, you need to use Pandoc's templating system instead to change the look and feel of your output. You can pass your options to Pandoc from within your Org document.

Excellent pointer. I shall have a look. I could not figure out where do ox-pandoc or pandoc-templates specify the font?

Honestly speaking, I am trying to make minor changes as follows:

  1. Change the font to junicode. I tried with org headers like:
#+LaTeX_Header: \usepackage{fontspec}
#+LaTeX_Header: \usepackage{junicode}
#+LATEX_HEADER: \setmainfont{Junicode}
#+PANDOC_OPTIONS: --pdf-engine=lualatex

did NOT work! C-c C-e p 5 reports,

Args out of range: "--pdf-engine=lualatex", 1579, 1580

Yet it works with C-c C-e l o as follows, but the tables are not autoformatted (the bottleneck, I am trying to avoid by using ox-pandoc as seen in the screenshot below:

pic-selected-241112-0258-47

When I change the pdf-engine to #+LATEX_COMPILER: lualatex, C-c C-e p 5 works, but the font directive nor ToC directives are not complied to as seen below:
pic-selected-241112-0307-36

  1. Assign a separate page for TITLE, SUBTITLE, AUTHOR and Date.

  2. Assign a separate page for ToC with tocdepth to 5. I tried with:

* #+OPTIONS: timestamp:nil toc:nil
#+BEGIN_EXPORT latex
   \clearpage \setcounter{tocdepth}{5} \tableofcontents \clearpage
#+END_EXPORT

but did not work with ox-pandoc, but works with org-export (C-c C-e l o) as seen in the screenshot below, yet produces without a cover as desired in 2 above.
pic-selected-241112-0259-03

What could be related header options in orgmode file to achieve above without messing with ox-pandoc code? Appreciate that. I checked

* Document options
, but could not find the options I wanted to make changes as above.

For your scrutiny, here is the orgmode file, I used to produce:

#+TITLE: My Document Title
#+AUTHOR: Your Name
#+OPTIONS: toc:nil
#+LATEX_HEADER: \usepackage{fontspec}
#+LATEX_HEADER: \setmainfont{Junicode}
#+LATEX_COMPILER: lualatex
;; #+PANDOC_OPTIONS: --pdf-engine=lualatex

#+BEGIN_EXPORT latex
   \clearpage \setcounter{tocdepth}{5} \tableofcontents \clearpage
#+END_EXPORT

* Introduction
This is my document with Junicode font.
| Short Column | Long Column                                               |
|--------------+----------------------------------------------------------|
| Some Text    | Here is a long sentence that will need to autofit in the table cells. It will break nicely to fit. |
| More Text    | Another long sentence that has to fit within the column width, so we will ensure it gets wrapped appropriately. |

* Main Content
Here is some example text. This section will contain sentences that can be long enough to wrap properly to fit within the table columns. 

| Column 1                 | Column 2                             |
|--------------------------|-------------------------------------|
| This is a very long sentence that should be wrapped automatically. | Another lengthy explanation that needs to fit within the column width. |
| This will break to the next line if it does not fit in the column. | Short text. |

* Another Section
Content of another section.

For example, if you have a pandoc templates called "scimax.tex" (saved, by default, in ~/.pandoc/templates/) you can tell ox-pandoc to use this template by adding the header #+pandoc_options: template:scimax.tex to your document.

Does this help?

Thanks for the pointer to pandoc-templates. I shall try to look into. Thanks @a-fent for such useful information.

Cheers,
/zenny

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants