0

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?

enter image description here

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

enter image description here

7
  • There is some confusion here: your tags indicate that you are using Org mode (presumably to write your file) and that you are using preview-latex to preview the latex. The trouble is that preview-latex is part of AucTeX 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.
    – NickD
    Apr 2, 2022 at 14:45
  • 1
    @NickD edited the question as per your recommendation. My org mode config does not have anything specific to latex previews other than the scaling of them.
    – sab hoque
    Apr 2, 2022 at 15:44
  • Can you also add a description of how you produced the image? Did you export the Org mode file to a .tex file using the LaTeX exporter and then you opened the .tex file with AucTex and used its preview capabilities? Please add a step-by-step description to your question.
    – NickD
    Apr 2, 2022 at 16:34
  • I couldn't compile what you posted: I had to add a \usepackage{fancyhdr} and a \usepackage{hyperref} to tutoring.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.
    – NickD
    Apr 3, 2022 at 2:01
  • 2
    OK - somebody who knows what Doom does will have to chime in. I don't know anything about it. I added a Doom tag: if you had added it to begin with, you would have saved me all this time.
    – NickD
    Apr 3, 2022 at 2:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.