5

I have a text file that I want to turn into a pdf. I found org-latex-export-to-pdf so I've saved the text file as an org file and when I run the command M-x org-latex-export-to-pdf I get a pdf file but I want to go more into how to customize the look of the resulting pdf. Looking at the .tex (LaTex) file I see there there is

% Created 2016-06-25 Sat 00:20
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{fixltx2e}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\author{Me}
\date{\today}
\title{}
\hypersetup{
 pdfauthor={Me},
 pdftitle={},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 24.5.3 (Org mode 8.3.4)},
 pdflang={English}}
\begin{document}

\tableofcontents

Is there an emacs variable for setting the documentclass part of the latex file? Setting a default for org-latex-export-to-pdf so I don't have to include the headers defined here My goal is mainly changing textsize, font type, taking out page numbers, space after paragraph.

Side question as well, from the looking around I see that you can install external packages such as org-article, XeTex then follow this blog but what is the bare minimum to be able to make the above changes? Are those extra packages even needed?

EDIT: The usepackage lines I'll probably have to look at later but for now I'm mainly concerned with the documentclass. To start, I've tried adding

#+LATEX_CLASS: article
#+LATEX_CLASS_OPTIONS: [44pt]

but the font size doesn't seem to change in the resulting exported pdf file though I do see this at the top of the .tex file (the text in the pdf still looks like 11pt)

% Created 2016-06-26 Sun 16:31
\documentclass[44pt]{article}
3
  • The article latex class does not allow arbitrary font sizes. IIRC only 10pt, 11pt and 12pt can be used. So it's not Emacs/Org-mode fault.
    – VanLaser
    Commented Jun 26, 2016 at 20:57
  • @VanLaser Would you know which class would be appropriate for me? I want to simply modify a few things, i.e. font size, font, no page numbers, and adding space between newlines. Looking through all alternative classes here is a bit daunting being a newbie. Is it possible to create my own class for me to use without going through Latex? What is the simplest way to accomplish fontsize/font/nopagenumbers/spacebetween newlines changes?
    – irregular
    Commented Jun 26, 2016 at 21:58
  • 1
    The following (short) video is not exactly what you have searched for, but imo it is a pretty nice solution for your problem: Perfect Emacs Org Mode Exports to LaTeX – Straightforward Emacs by Jake B
    – Gurga
    Commented Aug 17, 2021 at 16:55

2 Answers 2

5

The \documentclass part of the export is controlled by: org-latex-classes, org-latex-default-class and the class specified in the org file using #+LATEX_CLASS. Only classes listed in org-latex-classes can be used in org-latex-default-class or #+LATEX_CLASS.

The class options are given in the second element of each org-latex-classes entry. If you want to add more classes you can modify the existing entries, changing only the class name and options. amsart is a common alternative to article.

Additional packages can be added to org-latex-packages-alist to have them included in every export. In my opinion it is better not to modify this, as it hurts the portability of all your documents.

3

I take a different approach. I export the Org file without the header (C-c C-e C-b h l, and \input the resulting latex code in my own main.tex.

This gives me full flexibility on LaTeX rendering.

Regarding the document class: you're doing it fine, but 44pt is not a valid option for the article class. This is a LaTeX issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.