-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathexample.tex
207 lines (144 loc) · 6.79 KB
/
example.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
\documentclass[12pt]{article}
\usepackage[pdftex,pagebackref,letterpaper=true,colorlinks=true,pdfpagemode=none,urlcolor=blue,linkcolor=blue,citecolor=blue,pdfstartview=FitH]{hyperref}
\usepackage{amsmath,amsfonts}
\usepackage{graphicx}
\usepackage{color}
\setlength{\oddsidemargin}{0pt}
\setlength{\evensidemargin}{0pt}
\setlength{\textwidth}{6.0in}
\setlength{\topmargin}{0in}
\setlength{\textheight}{8.5in}
\setlength{\parindent}{0in}
\setlength{\parskip}{5px}
\input{macrosblog}
\begin{document}
Look at the document source to see how to \sout{strike out} text, how
to \begin{red}use\end{red} \begin{green}different\end{green} \begin{blue}colors\end{blue},
and how to \href{http://www.google.com}{link to URLs with snapshot preview}
and how to \hrefnosnap{http://www.google.com}{link to URLs without snapshot preview}.
There is a command which is ignored by pdflatex and which
defines where to cut the post in the version displayed on the
main page\more
Anything between the conditional declarations {\em ifblog . . . fi}
is ignored by LaTeX and processed by latex2wp. Anything
between {\em iftex . . . fi} is processed by LaTex and ignored
by latex2wp.
\ifblog \begin{green}This green sentence appears only in WordPress \end{green} \fi
\iftex \begin{red}This red sentence appears only in the LaTeX preview \end{red} \fi
This is useful if one, in desperation, wants to put pure HTML commands
in the {\em ifblog . . . fi} scope.
\begin{lemma}[Main] \label{lm:main}
Let $\cal F$ be a total ramification of a compactifier, then
\begin{equation} \label{eq:lemma} \forall g \in {\cal F}. g^2 = \eta \end{equation}
\end{lemma}
The (modifiable) numbering scheme is that lemmas, theorems,
propositions, remarks and corollaries share the same counters,
while exercises and examples have each their own counter.
\begin{theorem} \label{th:ad} The ad\`ele of a number field is never
hyperbolically transfinite.
\end{theorem}
\begin{proof} Left as an exercise. \end{proof}
\begin{exercise} Find a counterexample to Theorem \ref{th:ad}.
\end{exercise}
\begin{exercise}[Advanced] Prove Lemma \ref{lm:main}. \end{exercise}
Note that accented characters are allowed. Unfortunately,
Erd\H os's name cannot be properly typeset in HTML.
(Note that to get the above approximation, you need to type
backslash-H-space-o, rather than backslash-H-{o}. Both are
good in LaTeX, but only the second is recognized by LaTeX2WP.)
One can correctly type the names of H\aa stad, Szemer\'edi,
\v{C}ech, and so on.
It is possible to have numbered equations
\begin{equation} \label{eq:test} \frac 1 {x^2} \ge 0 \end{equation}
and unnumbered equations
$$ t(x) - \frac 12 > x^{\frac 13} $$
Unnumbered equations can be created with the double-dollar sign
command or with the backslash-square bracket command.
\[ f(x) = \int_{-\infty}^{x} \frac 1 {t^2} dt \]
It is possible to refer to equations and
theorems via the {\em ref}, {\em eqref} and {\em label} LaTeX
commands, for example to Equation (\ref{eq:test}),
to Equation \eqref{eq:lemma},
and to Lemma \ref{lm:main} above.
eqnarray* is supported, but not eqnarray:
\begin{eqnarray*}
f(x) & < & x^2 - y^2\\
& = & (x+y) \cdot (x-y)
\end{eqnarray*}
{\em You {\bf can} nest a {\bf bold} text inside an emphasized
text or viceversa.}
The theorem-like environments {\em theorem}, {\em lemma},
{\em proposition}, {\em remark}, {\em corollary}, {\em example}
and {\em exercise} are defined, as is the {\em proof} environment.
The LaTex commands to type \$, \%, and \&\ are supported outside
math mode, and \%\ and \&\ are supported in math mode as well:
\[ 30 \& 10 \% \]
The section symbol \S\ is also supported.
WordPress has trouble if a LaTeX expression containing a $<$
symbol, such as $x^2 < x^2 + 1$ is followed by an expression
containing a $>$ symbol, such as $(x+y)^2 > (x+y)^2 - 3$. This
is fixed by converting the inequality symbols into ``HTML
character codes.'' Always write the symbols $<$ and $>$ in
math mode.
It it is possible to have tabular environments, both with borders
(the border will not be displayed in the LaTeX preview), as in
\begin{btabular}{lr}
blog & quality\\
what's new & excellent\\
in theory & poor
\end{btabular}
and without borders as in
\begin{tabular}{ccc}
$a$ & $\rightarrow$ & $b$\\
$\downarrow$ & & $\uparrow$\\
$c$ & $\rightarrow$ & $d$
\end{tabular}
(The tabular environments will be centered in WordPress, but
not in the LaTeX preview.)
And it is possible to include a picture so that the pdf file produced
with pdflatex imports it from a local image file (which has to be
pdf, gif, jpeg, or png) and the WordPress post imports it from a URL.
\image{width = 400}{http://imgs.xkcd.com/comics/donald_knuth.png}{knuth.png}
The {\em image} command used to generate the above image
has three parameter: a size parameter for either the width or the height,
expressed in pixels (if different from the original resolution, the picture
will be scaled), a URL for the location of the image (this will be used
by WordPress) and a local file name (which will used by pdflatex).
It is possible to have numbered and unnumbered sections and subsections.
References to {\em label} commands which are not in the scope of
a numbered equation or a numbered theorem-like environment
will refer to the section number,
such as a reference to Section \ref{sec} below.
HTML does not have good support for itemized list with
descriptors (what one gets in LaTeX using the {\em itemize} environment
with optional parameters in square brackets after the {\em item} commands).
We can only offer the following rather ugly rendering:
\begin{itemize}
\item [Case a.] Description of case a
\item [Case b.] Description of case b
\end{itemize}
\section*{Examples of Sections}
\subsection*{And Subsections}
\section{A section}
\label{sec}
\subsection{And a subsection}
\section{Changing the style}
The file latex2wpstyle.py contains several definitions that determine
the appearance of the WordPress translation. It should be self-explanatory
to change the way sections, subsections, proofs and theorem-like
environments are typeset, and to change the numbering scheme
for theorem-like environments.
The variable $M$ in latex2wpstyle.py contains a list of pairs of strings.
For every pair, every occurrence of the first string in the document is
replaced by an occurrence of the second before proceeding to the
conversion from LaTeX to WordPress. If you want to use simple macros
(which do not involve parameter-passing) then edit $M$ to add support
for your own LaTeX macros. (You will have to define the macros in
macrosblog.tex as well, otherwise you will not be able to compile
your LaTeX file and preview it.)
Some macros are already defined. For example, backslash-E produces
an expectation symbol:
\[ \E_{x \in X} f(x) := \sum_{x\in X} \P [x] \cdot f(x) \]
Some more macros (see the LaTeX source)
\[ \B, \R , \C, \Z, \N , \Q, \eps \]
\end{document}