Merge branch 'jlduran-latex-tightlist'

This commit is contained in:
John MacFarlane 2015-04-17 19:37:16 -07:00
commit aaf5e67624
6 changed files with 40 additions and 34 deletions

@ -1 +1 @@
Subproject commit e8aec53fad6b4d587a44af5ca76c4b809569f15d Subproject commit d248c9d6382ded310564424bf110cdf159785fac

View file

@ -416,7 +416,7 @@ blockToLaTeX (BulletList lst) = do
let inc = if incremental then "[<+->]" else "" let inc = if incremental then "[<+->]" else ""
items <- mapM listItemToLaTeX lst items <- mapM listItemToLaTeX lst
let spacing = if isTightList lst let spacing = if isTightList lst
then text "\\itemsep1pt\\parskip0pt\\parsep0pt" then text "\\tightlist"
else empty else empty
return $ text ("\\begin{itemize}" ++ inc) $$ spacing $$ vcat items $$ return $ text ("\\begin{itemize}" ++ inc) $$ spacing $$ vcat items $$
"\\end{itemize}" "\\end{itemize}"
@ -451,7 +451,7 @@ blockToLaTeX (OrderedList (start, numstyle, numdelim) lst) = do
else "\\setcounter" <> braces enum <> else "\\setcounter" <> braces enum <>
braces (text $ show $ start - 1) braces (text $ show $ start - 1)
let spacing = if isTightList lst let spacing = if isTightList lst
then text "\\itemsep1pt\\parskip0pt\\parsep0pt" then text "\\tightlist"
else empty else empty
return $ text ("\\begin{enumerate}" ++ inc) return $ text ("\\begin{enumerate}" ++ inc)
$$ stylecommand $$ stylecommand
@ -465,7 +465,7 @@ blockToLaTeX (DefinitionList lst) = do
let inc = if incremental then "[<+->]" else "" let inc = if incremental then "[<+->]" else ""
items <- mapM defListItemToLaTeX lst items <- mapM defListItemToLaTeX lst
let spacing = if all isTightList (map snd lst) let spacing = if all isTightList (map snd lst)
then text "\\itemsep1pt\\parskip0pt\\parsep0pt" then text "\\tightlist"
else empty else empty
return $ text ("\\begin{description}" ++ inc) $$ spacing $$ vcat items $$ return $ text ("\\begin{description}" ++ inc) $$ spacing $$ vcat items $$
"\\end{description}" "\\end{description}"

View file

@ -42,7 +42,7 @@ tests = [ testGroup "code blocks"
, testGroup "definition lists" , testGroup "definition lists"
[ "with internal link" =: definitionList [(link "#go" "" (str "testing"), [ "with internal link" =: definitionList [(link "#go" "" (str "testing"),
[plain (text "hi there")])] =?> [plain (text "hi there")])] =?>
"\\begin{description}\n\\itemsep1pt\\parskip0pt\\parsep0pt\n\\item[{\\hyperref[go]{testing}}]\nhi there\n\\end{description}" "\\begin{description}\n\\tightlist\n\\item[{\\hyperref[go]{testing}}]\nhi there\n\\end{description}"
] ]
, testGroup "math" , testGroup "math"
[ "escape |" =: para (math "\\sigma|_{\\{x\\}}") =?> [ "escape |" =: para (math "\\sigma|_{\\{x\\}}") =?>

View file

@ -64,6 +64,8 @@
\setlength{\parindent}{0pt} \setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt} \setlength{\parskip}{6pt plus 2pt minus 1pt}
\setlength{\emergencystretch}{3em} % prevent overfull lines \setlength{\emergencystretch}{3em} % prevent overfull lines
\newcommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{0} \setcounter{secnumdepth}{0}
\date{} \date{}

View file

@ -45,6 +45,8 @@
\setlength{\parindent}{0pt} \setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt} \setlength{\parskip}{6pt plus 2pt minus 1pt}
\setlength{\emergencystretch}{3em} % prevent overfull lines \setlength{\emergencystretch}{3em} % prevent overfull lines
\newcommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{0} \setcounter{secnumdepth}{0}
\date{} \date{}

View file

@ -57,6 +57,8 @@
\setlength{\parindent}{0pt} \setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt} \setlength{\parskip}{6pt plus 2pt minus 1pt}
\setlength{\emergencystretch}{3em} % prevent overfull lines \setlength{\emergencystretch}{3em} % prevent overfull lines
\newcommand{\tightlist}{%
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{0} \setcounter{secnumdepth}{0}
\VerbatimFootnotes % allows verbatim text in footnotes \VerbatimFootnotes % allows verbatim text in footnotes
@ -141,7 +143,7 @@ A list:
\begin{enumerate} \begin{enumerate}
\def\labelenumi{\arabic{enumi}.} \def\labelenumi{\arabic{enumi}.}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item \item
item one item one
\item \item
@ -196,7 +198,7 @@ These should not be escaped: \$ \\ \> \[ \{
Asterisks tight: Asterisks tight:
\begin{itemize} \begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item \item
asterisk 1 asterisk 1
\item \item
@ -219,7 +221,7 @@ Asterisks loose:
Pluses tight: Pluses tight:
\begin{itemize} \begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item \item
Plus 1 Plus 1
\item \item
@ -242,7 +244,7 @@ Pluses loose:
Minuses tight: Minuses tight:
\begin{itemize} \begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item \item
Minus 1 Minus 1
\item \item
@ -268,7 +270,7 @@ Tight:
\begin{enumerate} \begin{enumerate}
\def\labelenumi{\arabic{enumi}.} \def\labelenumi{\arabic{enumi}.}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item \item
First First
\item \item
@ -281,7 +283,7 @@ and:
\begin{enumerate} \begin{enumerate}
\def\labelenumi{\arabic{enumi}.} \def\labelenumi{\arabic{enumi}.}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item \item
One One
\item \item
@ -331,17 +333,17 @@ Multiple paragraphs:
\subsection{Nested}\label{nested} \subsection{Nested}\label{nested}
\begin{itemize} \begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item \item
Tab Tab
\begin{itemize} \begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item \item
Tab Tab
\begin{itemize} \begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item \item
Tab Tab
\end{itemize} \end{itemize}
@ -352,14 +354,14 @@ Here's another:
\begin{enumerate} \begin{enumerate}
\def\labelenumi{\arabic{enumi}.} \def\labelenumi{\arabic{enumi}.}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item \item
First First
\item \item
Second: Second:
\begin{itemize} \begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item \item
Fee Fee
\item \item
@ -381,7 +383,7 @@ Same thing but with paragraphs:
Second: Second:
\begin{itemize} \begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item \item
Fee Fee
\item \item
@ -424,7 +426,7 @@ Same thing but with paragraphs:
\begin{enumerate} \begin{enumerate}
\def\labelenumii{\roman{enumii}.} \def\labelenumii{\roman{enumii}.}
\setcounter{enumii}{3} \setcounter{enumii}{3}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item \item
sublist with roman numerals, starting with 4 sublist with roman numerals, starting with 4
\item \item
@ -432,7 +434,7 @@ Same thing but with paragraphs:
\begin{enumerate} \begin{enumerate}
\def\labelenumiii{(\Alph{enumiii})} \def\labelenumiii{(\Alph{enumiii})}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item \item
a subsublist a subsublist
\item \item
@ -445,27 +447,27 @@ Nesting:
\begin{enumerate} \begin{enumerate}
\def\labelenumi{\Alph{enumi}.} \def\labelenumi{\Alph{enumi}.}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item \item
Upper Alpha Upper Alpha
\begin{enumerate} \begin{enumerate}
\def\labelenumii{\Roman{enumii}.} \def\labelenumii{\Roman{enumii}.}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item \item
Upper Roman. Upper Roman.
\begin{enumerate} \begin{enumerate}
\def\labelenumiii{(\arabic{enumiii})} \def\labelenumiii{(\arabic{enumiii})}
\setcounter{enumiii}{5} \setcounter{enumiii}{5}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item \item
Decimal start with 6 Decimal start with 6
\begin{enumerate} \begin{enumerate}
\def\labelenumiv{\alph{enumiv})} \def\labelenumiv{\alph{enumiv})}
\setcounter{enumiv}{2} \setcounter{enumiv}{2}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item \item
Lower alpha with paren Lower alpha with paren
\end{enumerate} \end{enumerate}
@ -476,14 +478,14 @@ Nesting:
Autonumbering: Autonumbering:
\begin{enumerate} \begin{enumerate}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item \item
Autonumber. Autonumber.
\item \item
More. More.
\begin{enumerate} \begin{enumerate}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item \item
Nested. Nested.
\end{enumerate} \end{enumerate}
@ -502,7 +504,7 @@ B. Williams
Tight using spaces: Tight using spaces:
\begin{description} \begin{description}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item[apple] \item[apple]
red fruit red fruit
\item[orange] \item[orange]
@ -514,7 +516,7 @@ yellow fruit
Tight using tabs: Tight using tabs:
\begin{description} \begin{description}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item[apple] \item[apple]
red fruit red fruit
\item[orange] \item[orange]
@ -556,7 +558,7 @@ orange block quote
Multiple definitions, tight: Multiple definitions, tight:
\begin{description} \begin{description}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item[apple] \item[apple]
red fruit red fruit
@ -592,7 +594,7 @@ orange fruit
\begin{enumerate} \begin{enumerate}
\def\labelenumi{\arabic{enumi}.} \def\labelenumi{\arabic{enumi}.}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item \item
sublist sublist
\item \item
@ -718,7 +720,7 @@ Ellipses\ldots{}and\ldots{}and\ldots{}.
\section{LaTeX}\label{latex} \section{LaTeX}\label{latex}
\begin{itemize} \begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item \item
\cite[22-23]{smith.1899} \cite[22-23]{smith.1899}
\item \item
@ -741,7 +743,7 @@ Ellipses\ldots{}and\ldots{}and\ldots{}.
These shouldn't be math: These shouldn't be math:
\begin{itemize} \begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item \item
To get the famous equation, write \texttt{\$e\ =\ mc\^{}2\$}. To get the famous equation, write \texttt{\$e\ =\ mc\^{}2\$}.
\item \item
@ -768,7 +770,7 @@ Cat & 1 \\ \hline
Here is some unicode: Here is some unicode:
\begin{itemize} \begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item \item
I hat: Î I hat: Î
\item \item
@ -892,7 +894,7 @@ Here's an \href{/script?foo=1\&bar=2}{inline link in pointy braces}.
With an ampersand: \url{http://example.com/?foo=1\&bar=2} With an ampersand: \url{http://example.com/?foo=1\&bar=2}
\begin{itemize} \begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item \item
In a list? In a list?
\item \item
@ -958,7 +960,7 @@ Notes can go in quotes.\footnote{In quote.}
\begin{enumerate} \begin{enumerate}
\def\labelenumi{\arabic{enumi}.} \def\labelenumi{\arabic{enumi}.}
\itemsep1pt\parskip0pt\parsep0pt \tightlist
\item \item
And in list items.\footnote{In list.} And in list items.\footnote{In list.}
\end{enumerate} \end{enumerate}