Variables controlling HTML and LaTeX export in Emacs Org mode
Emacs Org mode is a very powerful, versatile and extensible package, which can be used for personal information management, maintenance of a wiki platform, implementation of a GTD system, etc. With a simple markup grammar, it is very easy for the user to perform a structured typesetting in pure ASCII. The text file can then be exported into various formats, such as PDF, OpenOffice, HTML, LaTeX, TaskJuggler (a professional project management tool), iCalendar and so on. In my daily work, typesetting math with LaTeX and publishing them as blog post are common tasks. Therefore in this post, those variables controlling HTML and LaTeX export in Emacs Org mode, along with LaTeX fragments processing will be summarized.
1. org-export-with-LaTeX-fragments: when it is true, enable LaTeX fragments export using MathJax mode.
2. org-export-html-mathjax-options: MathJax is configured using this variable or insert something like the following into the buffer:
#+MATHJAX: align:"left" mathml:t path:"/MathJax/MathJax.js"
The documentation for this variable is:
org-export-html-mathjax-options is a variable defined in `org-html.el‘. Its value is ((path "http://orgmode.org/mathjax/MathJax.js") (scale "100") (align "center") (indent "2em") (mathml nil)) Documentation: Options for MathJax setup. path The path where to find MathJax scale Scaling for the HTML-CSS backend, usually between 100 and 133 align How to align display math: left, center, or right indent If align is not center, how far from the left/right side? mathml Should a MathML player be used if available? This is faster and reduces bandwidth use, but currently sometimes has lower spacing quality. Therefore, the default is nil. When browsers get better, this switch can be flipped.
2. org-export-htmlize-output-type: Output type to be used by htmlize when formatting code snippets. Choices are `css‘, to export the CSS selectors only, or `inline-css‘, to export the CSS attribute values inline in the HTML. We use as default `inline-css‘, in order to make the resulting HTML self-containing. Therefore, for a self maintained website or blog, we‘d better use the css mode.
3. org-export-with-TeX-macros: Non-nil means interpret simple TeX-like macros when exporting. For example, HTML export converts \alpha to α and \AA to Å. Not only real TeX macros will work here, but the standard HTML entities for math can be used as macro names as well. In my case, I set it to nil because I do not want convert the simple TeX-like macros into html.
4. org-export-html-style: Org-wide style definitions for exported HTML files. This variable needs to contain the full HTML structure to provide a style, including the surrounding HTML tags. If you set the value of this variable, you should consider to include definitions for the following classes: title, todo, done, timestamp, timestamp-kwd, tag, target. As the value of this option simply gets inserted into the HTML <head> header, you can "misuse" it to add arbitrary text to the header.
5. org-export-html-style-extra: Additional style information for HTML export. The value of this variable is inserted into the HTML buffer right after the value of `org-export-html-style‘. Use this variable for per-file settings of style information, and do not forget to surround the style settings with <style>...</style> tags.
6. org-export-latex-classes: Alist of LaTeX classes and associated header and structure. If #+LaTeX_CLASS is set in the buffer, use its value and the associated information. Here is the structure of each cell:
(class-name
header-string
(numbered-section . unnumbered-section)
...)
The HEADER-STRING is the header that will be inserted into the LaTeX file. It should contain the \documentclass macro, and anything else that is needed for this setup. To this header, the following commands will be added:
- Calls to \usepackage for all packages mentioned in the variables `org-export-latex-default-packages-alist‘ and `org-export-latex-packages-alist‘. Thus, your header definitions should avoid to also request these packages.
- Lines specified via "#+LaTeX_HEADER:"
If you need more control about the sequence in which the header is built up, or if you want to exclude one of these building blocks for a particular class, you can use the following macro-like placeholders.
[DEFAULT-PACKAGES] \usepackage statements for default packages [NO-DEFAULT-PACKAGES] do not include any of the default packages [PACKAGES] \usepackage statements for packages [NO-PACKAGES] do not include the packages [EXTRA] the stuff from #+LaTeX_HEADER [NO-EXTRA] do not include #+LaTeX_HEADER stuff [BEAMER-HEADER-EXTRA] the beamer extra headers
According to the above documentation, my header string used for various classes is like this:
“\\documentclass[11pt]{article} [NO-DEFAULT-PACKAGES] \\input{note-template} [EXTRA] [PACKAGES]”
where note-template.tex is my own template file in which common commands are defined and packages are included.
7. org-format-latex-header: being different from org-export-latex-classes, this variable is only the document header used for processing LaTeX fragments, butnot for exporting a complete LaTeX document. It is imperative that this header make sure that no page number appears on the page. The package defined in the variables `org-export-latex-default-packages-alist‘ and `org-export-latex-packages-alist‘ will either replace the placeholder "[PACKAGES]" in this header, or they will be appended. So the value of this variable is similar to the header string in org-export-latex-classes:
"\\documentclass{article}
\\usepackage{fullpage} % do not remove
[NO-DEFAULT-PACKAGES]
\\input{note-template}
[PACKAGES]
\\pagestyle{empty} % do not remove"
8. org-format-latex-options: this variable contains 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. :background the background color, or "Transparent". `default‘ means use the background of the default 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 \ [...\]
Variables controlling HTML and LaTeX export in Emacs Org mode,古老的榕树,5-wow.com
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。