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

时间: 2024-10-18 11:35:01

Variables controlling HTML and LaTeX export in Emacs Org mode的相关文章

Emacs org 转换成freemap

可以在org中编写文档,然后用一个脚本就可以将其转换成freemap的文件. 脚本文件可以从这里下载: 将其复制到~/.emacs.d/freemind.el 在init.el中添加一行: ;; freemind export (load "~/.emacs.d/freemind.el") 现在编辑一个用户和内容.org文件: * 用户数据 ** 用户基础数据 ** 用户行为数据 *** 消费行为 *** 观影行为 *** 维修记录 * 影视内容 ** 电影内容 ** 综艺内容 ***

My Emacs Writing Setup

My Emacs Writing Setup Table of Contents 1. About this Document 1.1. Related Materials 1.2. Change History 2. License 3. Why Emacs? 4. Setup 5. Structuring a Story 6. Adding Todos 7. Finding my Place 7.1. Bookmarks 8. Markup 9. Export 10. Emacs and S

Unix必备知识精华版

一.注意事项 命令和参数之间必需用空格隔开,参数和参数之间也必需用空格隔开. 一行不能超过256个字符:大小写有区分. 二.特殊字符含义 文件名以“.”开头的都是隐藏文件/目录,只需在文件/目录名前加“.”就可隐藏它. ~/       表示主目录. ./       当前目录(一个点). ../      上一级目录(两个点). ;        多个命令一起用. >  >>    输出重定向  .将一个命令的输出内容写入到一个文件里面.如果该文件存在, 就将该文件的内容覆盖: 如果不

man bash

BASH(1) General Commands Manual BASH(1) NAME bash - GNU Bourne-Again SHell SYNOPSIS bash [options] [command_string | file] COPYRIGHT Bash is Copyright (C) 1989-2013 by the Free Software Foundation, Inc. DESCRIPTION Bash is an sh-compatible command la

Netperf Manual

Netperf Manual Section 0. The Legal Stuff Section 1. Introduction Conventions and Definitions Section 2. Installing Netperf Getting the netperf bits from the Internet Installing the bits Verifying the bits Running netserver as a standalone Daemon Fin

ros学习摘要

参考:http://wiki.ros.org/cn/ROS/Tutorials 1.安装并配置ROS环境 1.1 安装ROS  :apt安装无权限 1.2管理环境 : ROS是依赖组合空间的概念,配置脚本环境. 安装ROS期间,你会看到提示说需要 source 多个setup.*sh文件中的某一个,或者甚至提示添加这条'source'命令到你的启动脚本里面. 检查配置的环境变量: export | grep ROS $ source /opt/ros/hydro/setup.bash 事先在.b

sqoop搭建

sqoop版本1.99.7#此搭建过程在最后启动job的时候失败了,每个版本的差异性蛮大的. 版本下载链接:http://pan.baidu.com/s/1pKYrusz 密码:7ib5 搭建sqoop之前,已经配置好了hadoop和java的环境 当第一次启动后,KILL掉HADOOP进程后出现的各种问题,重启机器解决问题. This script is Deprecated. Instead use start-dfs.sh and start-yarn.sh 错误: 找不到或无法加载主类

我的linux探索之路

LINUX 探索之路 LINUX 探索之路 Table of Contents 1 前言 2 配置 2.1 vim 2.2 emacs 2.3 输入法配置 2.4 bash 2.5 Ag 和 percol 2.6 git 2.7 github 2.8 Tmux 2.9 misc(杂项) 3 后言 1 前言 开源,分享,交流,合作 工欲善其事,必先利其器 无偿使用了他人的东西,你也会自发的分享自己的,这就是互助的基础和动力. 终于下定决心来到linux世界,正如<unix编程艺术>中所说的: 开

ORACLE安装(12c-Redhat6.5)

Oracle安装(12c-Redhat6.5) Redhat6.5系统准备 / 10G SWAP 4G /boot 200M /HOME 4G /usr 8G /var 4G /u01 Preinstallation Tasks Logging In to the System as root Checking the Hardware Requirements Checking the Software Requirements Checking the Network Setup Creat