6

Please advise if there is a simpler way to do this but I'm hoping to use Emacs + Xetex for turning a text file into a pdf. So far I am saving the text file as .org and I currently have

#+LATEX_CLASS: article
#+LATEX_CLASS_OPTIONS: [12pt]
#+latex_header: \usepackage[a4paper,top=1cm,bottom=1cm,left=1cm,right=1cm]{geometry}
#+latex_header: \usepackage{fontspec}
#+latex_header: \setmainfont{Arial}

#+begin_latex
    \begin{huge}
#+end_latex

Chapter 100

Beginning 
Story  
Plot  

Chapter 101
More Story 
Twist 
Satisfying Ending

#+begin_latex
    \end{huge}
#+end_latex

My goal is having the end pdf to be 24pt font, Arial, with some spacing between paragraphs (not each line). 12pt + encapsulating everything in \huge works quite well for 24pt. I'm trying to use Xetex for the Arial font but I get

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
! Fatal fontspec error: "cannot-use-pdftex"
! 
! The fontspec package requires either XeTeX or LuaTeX to function.
! 
! You must change your typesetting engine to, e.g., "xelatex" or "lualatex"
! instead of plain "latex" or "pdflatex".
! 
! See the fontspec documentation for further information.
! 
! For immediate help type H <return>.
!...............................................  

l.41  }

 ) )
(see the transcript file for additional information)
No pages of output.

I have Xetex installed but I'm not sure how to switch the typesetting engine. I have

(setq-default TeX-engine 'xetex)

in my .emacs but that doesn't seem to do it. Beginner at latex and org exporting to latex here, is there a simpler way of doing what I want to accomplish? Thanks.

1
  • According to the docs, you have to adjust the variable org-latex-pdf-process. TeX-engine is in effect when you open a .tex file and let AUCTeX pass your file to compiler. Jul 4, 2016 at 8:40

3 Answers 3

6

Add

#+LATEX_COMPILER: xelatex

to the header.

1
  • this does not change anything for me?
    – xeruf
    Jan 10, 2022 at 23:53
4

Emacs-fu blog presented a solution to use XeTeX to import with emacs.

You need to set org-latex-to-pdf-process to XeTeX, XeLaTeX or any other engine:

(setq org-latex-to-pdf-process 
  '("xelatex -interaction nonstopmode %f"
     "xelatex -interaction nonstopmode %f")) ;; for multiple passes

Also, if you can use an "Arial like" you can have a look at helvet package as stated in this answer and comments.

1
  • As mentioned by @MikeHoss, this variable name has changed. Also, you may want to add -output-directory %o before the file name, which the default variable value also includes.
    – Ivan Perez
    Jul 1, 2018 at 0:01
4

The variable has been changed to org-latex-pdf-process (note there is no to in the name). If you use customize-variable you will get a dropdown where you choose xelatex, etc.

1
  • Welcome to TeX.SX! Here you can find some tips for answering questions here
    – Bobyandbob
    Aug 7, 2017 at 19:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .