When I write latex to be included in org mode it includes the header styling which is to be applied to the pdf export only. This makes it difficult to use org mode with latex previews. Is there any way to remove the header styling and restore the normal latex previews?
In this picture for instance, there is more content below the latex preview that is not being shown.
Edit
#+STARTUP: nolatexpreview
#+TITLE: Lesson 10
#+AUTHOR: Sabiqul Hoque
#+OPTIONS: title:nil date:nil
#+LATEX_HEADER: \newcommand\Author{Sabiqul Hoque}
#+LATEX_HEADER: \newcommand\Subject{Physics}
#+LATEX_HEADER: \newcommand\Unit{Unit 1}
#+LATEX_HEADER: \newcommand\classnumber{Lesson 6b: Further Questions}
#+SETUPFILE: ~/.doom.d/templates/org-latex/tutoring/tutoring.org
* Electric Charge
Charge is the fundamental property of matter that exhibit
electrostatic attraction or repulsion in the presence of other
matter. The charges of free-standing particles are integer
multiples of the elementary charge $e$; because of this we say
that electric charge is quantized.
My config has latex previews turned on but when I include the setup file, the latex preview adds the headers which expand the latex preview to take a very large amount of space.
The relevant parts of the setup file (tutoring.org) are as follows:
#+LaTeX_CLASS: org-plain-latex
#+LaTeX_CLASS_OPTIONS: [letterpaper, 11pt]
#+LATEX_HEADER: \usepackage{titling}
#+LATEX_HEADER: \setlength{\droptitle}{-6em}
#+LATEX_HEADER: \usepackage[top=1in, bottom=1.25in, left=1.55in, right=1.55in]{geometry}
#+LATEX_HEADER: \usepackage{fancyhdr}
#+LATEX_HEADER: \pagestyle{fancyplain}
#+LATEX_HEADER: \headheight 35pt
#+LATEX_HEADER: \lhead{\Subject\\\Unit}
#+LATEX_HEADER: \chead{\textbf{\Large \classnumber}}
#+LATEX_HEADER: \rhead{\Author \\ \today}
#+LATEX_HEADER: \lfoot{}
#+LATEX_HEADER: \cfoot{}
#+LATEX_HEADER: \rfoot{\small\thepage}
#+LATEX_HEADER: \headsep 1.5em
#+LATEX_HEADER: \usepackage{hyperref}
My config defines the org-plain-latex style:
(with-eval-after-load 'ox-latex
(add-to-list 'org-latex-classes
'("org-plain-latex"
"\\documentclass{article}
[NO-DEFAULT-PACKAGES]
[PACKAGES]
[EXTRA]"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))))
Issue still remains when running emacs-q
preview-latex
to preview the latex. The trouble is thatpreview-latex
is part ofAucTeX
and has nothing to do with Org mode (which has its own way to preview LaTeX fragments). It would be clearer if, instead of showing an image of the preview, you actually showed the Org mode file itself (as text, not as an image: use triple-backticks to show it literally) and then you described how you produced the image above.\usepackage{fancyhdr}
and a\usepackage{hyperref}
totutoring.org
. You should also move the#+SETUPFILE
to the top of your Org mode file, otherwise things are out of sequence. But I still don't undertand what you did to produce the image. When I preview the resulting .tex file, the header/footer stuff is not part of the preview, but the whole paragraph about the electric charge is all present and corect.Doom
tag: if you had added it to begin with, you would have saved me all this time.