0

The LaTeX preview within Org mode has "diagnostic information", including "Scale=... Ligature=...". How can one hide that ?

Equation - code

Equation - preview

The org mode is

Org mode version 9.4.4 (9.4.4-25-g3a522a-elpaplus @ %AppData%/emax/elpa/org-plus-contrib-20210301/)

The org-format-latex-options variable is modified to have larger font.

org-format-latex-options is a variable defined in ‘org.el’.
Its value is
(:foreground default :background default :scale 2.0 :html-foreground "Black" :html-background "Transparent" :html-scale 1.0 :matchers
             ("begin" "$1" "$" "$$" "\\(" "\\["))
Original value was 
(:foreground default :background default :scale 1.0 :html-foreground "Black" :html-background "Transparent" :html-scale 1.0 :matchers
             ("begin" "$1" "$" "$$" "\\(" "\\["))

  You can customize this variable.

Documentation:
Options for creating images from LaTeX fragments.
This is a property list with the following properties:
:foreground  the foreground color for images embedded in Emacs, e.g. "Black".
             ‘default’ means use the foreground of the default face.
             ‘auto’ means use the foreground from the text face.
:background  the background color, or "Transparent".
             ‘default’ means use the background of the default face.
             ‘auto’ means use the background from the text face.
:scale       a scaling factor for the size of the images, to get more pixels
:html-foreground, :html-background, :html-scale
             the same numbers for HTML export.
:matchers    a list indicating which matchers should be used to
             find LaTeX fragments.  Valid members of this list are:
             "begin" find environments
             "$1"    find single characters surrounded by $.$
             "$"     find math expressions surrounded by $...$
             "$$"    find math expressions surrounded by $$....$$
             "\("    find math expressions surrounded by \(...\)
             "\["    find math expressions surrounded by \[...\]

[back]

The org-format-latex-header variable has the default value.

The document header used for processing LaTeX fragments.
It is imperative that this header make sure that no page number
appears on the page.  The package defined in the variables
‘org-latex-default-packages-alist’ and ‘org-latex-packages-alist’
will either replace the placeholder "[PACKAGES]" in this
header, or they will be appended.

Value:
"\\documentclass{article}
\\usepackage[usenames]{color}
[PACKAGES]
[DEFAULT-PACKAGES]
\\pagestyle{empty}             % do not remove
% The settings below are copied from fullpage.sty
\\setlength{\\textwidth}{\\paperwidth}
\\addtolength{\\textwidth}{-3cm}
\\setlength{\\oddsidemargin}{1.5cm}
\\addtolength{\\oddsidemargin}{-2.54cm}
\\setlength{\\evensidemargin}{\\oddsidemargin}
\\setlength{\\textheight}{\\paperheight}
\\addtolength{\\textheight}{-\\headheight}
\\addtolength{\\textheight}{-\\headsep}
\\addtolength{\\textheight}{-\\footskip}
\\addtolength{\\textheight}{-3cm}
\\setlength{\\topmargin}{1.5cm}
\\addtolength{\\topmargin}{-2.54cm}"

[back]

The org-preview-latex-default-process variable has the default value

org-preview-latex-default-process is a variable defined in ‘org.el’.
Its value is ‘dvipng’

  This variable has an alias: ‘org-latex-create-formula-image-program’.
  You can customize this variable.


This variable was introduced, or its default value was changed, in
version 26.1 of Emacs.

Documentation:
The default process to convert LaTeX fragments to image files.
All available processes and theirs documents can be found in
‘org-preview-latex-process-alist’, which see.

[back]

The org-preview-latex-process-alist variable has the default value

org-preview-latex-process-alist is a variable defined in ‘org.el’.
Its value is shown below.

  You can customize this variable.


This variable was introduced, or its default value was changed, in
version 26.1 of Emacs.

Documentation:
Definitions of external processes for LaTeX previewing.
Org mode can use some external commands to generate TeX snippet’s images for
previewing or inserting into HTML files, e.g., "dvipng".  This variable tells
‘org-create-formula-image’ how to call them.

The value is an alist with the pattern (NAME . PROPERTIES).  NAME is a symbol.
PROPERTIES accepts the following attributes:

  :programs           list of strings, required programs.
  :description        string, describe the process.
  :message            string, message it when required programs cannot be found.
  :image-input-type   string, input file type of image converter (e.g., "dvi").
  :image-output-type  string, output file type of image converter (e.g., "png").
  :image-size-adjust  cons of numbers, the car element is used to adjust LaTeX
                      image size showed in buffer and the cdr element is for
                      HTML file.  This option is only useful for process
                      developers, users should use variable
                      ‘org-format-latex-options’ instead.
  :post-clean         list of strings, files matched are to be cleaned up once
                      the image is generated.  When nil, the files with ".dvi",
                      ".xdv", ".pdf", ".tex", ".aux", ".log", ".svg",
                      ".png", ".jpg", ".jpeg" or ".out" extension will
                      be cleaned up.
  :latex-header       list of strings, the LaTeX header of the snippet file.
                      When nil, the fallback value is used instead, which is
                      controlled by ‘org-format-latex-header’,
                      ‘org-latex-default-packages-alist’ and
                      ‘org-latex-packages-alist’, which see.
  :latex-compiler     list of LaTeX commands, as strings.  Each of them is given
                      to the shell.  Place-holders "%t", "%b" and "%o" are
                      replaced with values defined below.
  :image-converter    list of image converter commands strings.  Each of them is
                      given to the shell and supports any of the following
                      place-holders defined below.

Place-holders used by ‘:image-converter’ and ‘:latex-compiler’:

  %f    input file name
  %b    base name of input file
  %o    base directory of input file
  %O    absolute output file name

Place-holders only used by ‘:image-converter’:

  %D    dpi, which is used to adjust image size by some processing commands.
  %S    the image size scale ratio, which is used to adjust image size by some
        processing commands.

Value:
((dvipng :programs
         ("latex" "dvipng")
         :description "dvi > png" :message "you need to install the programs: latex and dvipng." :image-input-type "dvi" :image-output-type "png" :image-size-adjust
         (1.0 . 1.0)
         :latex-compiler
         ("latex -interaction nonstopmode -output-directory %o %f")
         :image-converter
         ("dvipng -D %D -T tight -o %O %f"))
 (dvisvgm :programs
          ("latex" "dvisvgm")
          :description "dvi > svg" :message "you need to install the programs: latex and dvisvgm." :image-input-type "dvi" :image-output-type "svg" :image-size-adjust
          (1.7 . 1.5)
          :latex-compiler
          ("latex -interaction nonstopmode -output-directory %o %f")
          :image-converter
          ("dvisvgm %f -n -b min -c %S -o %O"))
 (imagemagick :programs
              ("latex" "convert")
              :description "pdf > png" :message "you need to install the programs: latex and imagemagick." :image-input-type "pdf" :image-output-type "png" :image-size-adjust
              (1.0 . 1.0)
              :latex-compiler
              ("pdflatex -interaction nonstopmode -output-directory %o %f")
              :image-converter
              ("convert -density %D -trim -antialias %f -quality 100 %O")))

[back]
6
  • What is the value of org-preview-latex-default-process? And what is the value of org-preview-latex-process-alist? Please edit your question and add this information. – NickD Mar 3 at 2:03
  • @NickD The values of org-preview-latex-default-process and org-preview-latex-process-alist were just added. :D – SOUser Mar 3 at 2:11
  • I don't really know what's happening, but I suspect it has more to do with LaTeX than with Org mode. Do you still have the problem if you use the original value of org-format-latex-options? If that does not work, you might have some debugging in front of you (and Org mode does not make it easy to debug this situation unfortunately). One possible hint: are you using the Fang Song fonts? Why is that appearing in your image? – NickD Mar 3 at 4:35
  • 1
    Try to export the file to PDF and see if the extra stuff is there and see if the extra stuff is there, Then compile the LaTeX file to DVI and use dvipng to convert it to an image: is the extra stuff there? If it is, post the LaTeX file (probably to the TeX SE site) and see if anybody has an idea. If the extra stuff is NOT there however, things get harder: normal export and preview follow different paths, so if the normal export cannot reproduce the problem, you'll have to produce the LaTeX file that preview produces in order to debug. Unfortunately, preview deletes the LaTeX file after ... – NickD Mar 3 at 4:52
  • 1
    ... producing the image, so you will have to modify the source code in order to convince Org mode NOT to delete it. Let's hope it does not come to that. – NickD Mar 3 at 4:54

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.