diff options
m--------- | data/templates | 13 | ||||
-rw-r--r-- | src/Text/Pandoc/Writers/LaTeX.hs | 6 | ||||
-rw-r--r-- | tests/Tests/Writers/LaTeX.hs | 2 | ||||
-rw-r--r-- | tests/lhs-test.latex | 2 | ||||
-rw-r--r-- | tests/lhs-test.latex+lhs | 2 | ||||
-rw-r--r-- | tests/writer.latex | 60 |
6 files changed, 45 insertions, 40 deletions
diff --git a/data/templates b/data/templates -Subproject e8aec53fad6b4d587a44af5ca76c4b809569f15 +Subproject d248c9d6382ded310564424bf110cdf159785fa diff --git a/src/Text/Pandoc/Writers/LaTeX.hs b/src/Text/Pandoc/Writers/LaTeX.hs index 58456e3ab..49bc27b58 100644 --- a/src/Text/Pandoc/Writers/LaTeX.hs +++ b/src/Text/Pandoc/Writers/LaTeX.hs @@ -416,7 +416,7 @@ blockToLaTeX (BulletList lst) = do let inc = if incremental then "[<+->]" else "" items <- mapM listItemToLaTeX lst let spacing = if isTightList lst - then text "\\itemsep1pt\\parskip0pt\\parsep0pt" + then text "\\tightlist" else empty return $ text ("\\begin{itemize}" ++ inc) $$ spacing $$ vcat items $$ "\\end{itemize}" @@ -451,7 +451,7 @@ blockToLaTeX (OrderedList (start, numstyle, numdelim) lst) = do else "\\setcounter" <> braces enum <> braces (text $ show $ start - 1) let spacing = if isTightList lst - then text "\\itemsep1pt\\parskip0pt\\parsep0pt" + then text "\\tightlist" else empty return $ text ("\\begin{enumerate}" ++ inc) $$ stylecommand @@ -465,7 +465,7 @@ blockToLaTeX (DefinitionList lst) = do let inc = if incremental then "[<+->]" else "" items <- mapM defListItemToLaTeX lst let spacing = if all isTightList (map snd lst) - then text "\\itemsep1pt\\parskip0pt\\parsep0pt" + then text "\\tightlist" else empty return $ text ("\\begin{description}" ++ inc) $$ spacing $$ vcat items $$ "\\end{description}" diff --git a/tests/Tests/Writers/LaTeX.hs b/tests/Tests/Writers/LaTeX.hs index f083176d0..d1cfd3ddf 100644 --- a/tests/Tests/Writers/LaTeX.hs +++ b/tests/Tests/Writers/LaTeX.hs @@ -42,7 +42,7 @@ tests = [ testGroup "code blocks" , testGroup "definition lists" [ "with internal link" =: definitionList [(link "#go" "" (str "testing"), [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" [ "escape |" =: para (math "\\sigma|_{\\{x\\}}") =?> diff --git a/tests/lhs-test.latex b/tests/lhs-test.latex index cf993af9b..a94a0540f 100644 --- a/tests/lhs-test.latex +++ b/tests/lhs-test.latex @@ -64,6 +64,8 @@ \setlength{\parindent}{0pt} \setlength{\parskip}{6pt plus 2pt minus 1pt} \setlength{\emergencystretch}{3em} % prevent overfull lines +\newcommand{\tightlist}{% + \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} \setcounter{secnumdepth}{0} \date{} diff --git a/tests/lhs-test.latex+lhs b/tests/lhs-test.latex+lhs index 746744cc8..b69a2add4 100644 --- a/tests/lhs-test.latex+lhs +++ b/tests/lhs-test.latex+lhs @@ -45,6 +45,8 @@ \setlength{\parindent}{0pt} \setlength{\parskip}{6pt plus 2pt minus 1pt} \setlength{\emergencystretch}{3em} % prevent overfull lines +\newcommand{\tightlist}{% + \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} \setcounter{secnumdepth}{0} \date{} diff --git a/tests/writer.latex b/tests/writer.latex index fab5c9325..63061649a 100644 --- a/tests/writer.latex +++ b/tests/writer.latex @@ -57,6 +57,8 @@ \setlength{\parindent}{0pt} \setlength{\parskip}{6pt plus 2pt minus 1pt} \setlength{\emergencystretch}{3em} % prevent overfull lines +\newcommand{\tightlist}{% + \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} \setcounter{secnumdepth}{0} \VerbatimFootnotes % allows verbatim text in footnotes @@ -141,7 +143,7 @@ A list: \begin{enumerate} \def\labelenumi{\arabic{enumi}.} -\itemsep1pt\parskip0pt\parsep0pt +\tightlist \item item one \item @@ -196,7 +198,7 @@ These should not be escaped: \$ \\ \> \[ \{ Asterisks tight: \begin{itemize} -\itemsep1pt\parskip0pt\parsep0pt +\tightlist \item asterisk 1 \item @@ -219,7 +221,7 @@ Asterisks loose: Pluses tight: \begin{itemize} -\itemsep1pt\parskip0pt\parsep0pt +\tightlist \item Plus 1 \item @@ -242,7 +244,7 @@ Pluses loose: Minuses tight: \begin{itemize} -\itemsep1pt\parskip0pt\parsep0pt +\tightlist \item Minus 1 \item @@ -268,7 +270,7 @@ Tight: \begin{enumerate} \def\labelenumi{\arabic{enumi}.} -\itemsep1pt\parskip0pt\parsep0pt +\tightlist \item First \item @@ -281,7 +283,7 @@ and: \begin{enumerate} \def\labelenumi{\arabic{enumi}.} -\itemsep1pt\parskip0pt\parsep0pt +\tightlist \item One \item @@ -331,17 +333,17 @@ Multiple paragraphs: \subsection{Nested}\label{nested} \begin{itemize} -\itemsep1pt\parskip0pt\parsep0pt +\tightlist \item Tab \begin{itemize} - \itemsep1pt\parskip0pt\parsep0pt + \tightlist \item Tab \begin{itemize} - \itemsep1pt\parskip0pt\parsep0pt + \tightlist \item Tab \end{itemize} @@ -352,14 +354,14 @@ Here's another: \begin{enumerate} \def\labelenumi{\arabic{enumi}.} -\itemsep1pt\parskip0pt\parsep0pt +\tightlist \item First \item Second: \begin{itemize} - \itemsep1pt\parskip0pt\parsep0pt + \tightlist \item Fee \item @@ -381,7 +383,7 @@ Same thing but with paragraphs: Second: \begin{itemize} - \itemsep1pt\parskip0pt\parsep0pt + \tightlist \item Fee \item @@ -424,7 +426,7 @@ Same thing but with paragraphs: \begin{enumerate} \def\labelenumii{\roman{enumii}.} \setcounter{enumii}{3} - \itemsep1pt\parskip0pt\parsep0pt + \tightlist \item sublist with roman numerals, starting with 4 \item @@ -432,7 +434,7 @@ Same thing but with paragraphs: \begin{enumerate} \def\labelenumiii{(\Alph{enumiii})} - \itemsep1pt\parskip0pt\parsep0pt + \tightlist \item a subsublist \item @@ -445,27 +447,27 @@ Nesting: \begin{enumerate} \def\labelenumi{\Alph{enumi}.} -\itemsep1pt\parskip0pt\parsep0pt +\tightlist \item Upper Alpha \begin{enumerate} \def\labelenumii{\Roman{enumii}.} - \itemsep1pt\parskip0pt\parsep0pt + \tightlist \item Upper Roman. \begin{enumerate} \def\labelenumiii{(\arabic{enumiii})} \setcounter{enumiii}{5} - \itemsep1pt\parskip0pt\parsep0pt + \tightlist \item Decimal start with 6 \begin{enumerate} \def\labelenumiv{\alph{enumiv})} \setcounter{enumiv}{2} - \itemsep1pt\parskip0pt\parsep0pt + \tightlist \item Lower alpha with paren \end{enumerate} @@ -476,14 +478,14 @@ Nesting: Autonumbering: \begin{enumerate} -\itemsep1pt\parskip0pt\parsep0pt +\tightlist \item Autonumber. \item More. \begin{enumerate} - \itemsep1pt\parskip0pt\parsep0pt + \tightlist \item Nested. \end{enumerate} @@ -502,7 +504,7 @@ B. Williams Tight using spaces: \begin{description} -\itemsep1pt\parskip0pt\parsep0pt +\tightlist \item[apple] red fruit \item[orange] @@ -514,7 +516,7 @@ yellow fruit Tight using tabs: \begin{description} -\itemsep1pt\parskip0pt\parsep0pt +\tightlist \item[apple] red fruit \item[orange] @@ -556,7 +558,7 @@ orange block quote Multiple definitions, tight: \begin{description} -\itemsep1pt\parskip0pt\parsep0pt +\tightlist \item[apple] red fruit @@ -592,7 +594,7 @@ orange fruit \begin{enumerate} \def\labelenumi{\arabic{enumi}.} -\itemsep1pt\parskip0pt\parsep0pt +\tightlist \item sublist \item @@ -718,7 +720,7 @@ Ellipses\ldots{}and\ldots{}and\ldots{}. \section{LaTeX}\label{latex} \begin{itemize} -\itemsep1pt\parskip0pt\parsep0pt +\tightlist \item \cite[22-23]{smith.1899} \item @@ -741,7 +743,7 @@ Ellipses\ldots{}and\ldots{}and\ldots{}. These shouldn't be math: \begin{itemize} -\itemsep1pt\parskip0pt\parsep0pt +\tightlist \item To get the famous equation, write \texttt{\$e\ =\ mc\^{}2\$}. \item @@ -768,7 +770,7 @@ Cat & 1 \\ \hline Here is some unicode: \begin{itemize} -\itemsep1pt\parskip0pt\parsep0pt +\tightlist \item I hat: Î \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} \begin{itemize} -\itemsep1pt\parskip0pt\parsep0pt +\tightlist \item In a list? \item @@ -958,7 +960,7 @@ Notes can go in quotes.\footnote{In quote.} \begin{enumerate} \def\labelenumi{\arabic{enumi}.} -\itemsep1pt\parskip0pt\parsep0pt +\tightlist \item And in list items.\footnote{In list.} \end{enumerate} |