Add booktabs package for LaTeX tables
[ci skip]
This commit is contained in:
parent
1213192cae
commit
fdaeec0c48
4 changed files with 52 additions and 52 deletions
2
README
2
README
|
@ -108,7 +108,7 @@ to PDF:
|
|||
Production of a PDF requires that a LaTeX engine be installed (see
|
||||
`--latex-engine`, below), and assumes that the following LaTeX packages are
|
||||
available: `amssymb`, `amsmath`, `ifxetex`, `ifluatex`, `listings` (if the
|
||||
`--listings` option is used), `fancyvrb`, `longtable`, `url`,
|
||||
`--listings` option is used), `fancyvrb`, `longtable`, `booktabs`, `url`,
|
||||
`graphicx`, `hyperref`, `ulem`, `babel` (if the `lang` variable is set),
|
||||
`fontspec` (if `xelatex` or `lualatex` is used as the LaTeX engine), `xltxtra`
|
||||
and `xunicode` (if `xelatex` is used).
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 713a8f63d5589ab9313869e47b03cf7f49e00e98
|
||||
Subproject commit f643a076d8c2b0b21391fd6aa1dedb2dd84c7e63
|
|
@ -453,12 +453,12 @@ blockToLaTeX (Header level (id',classes,_) lst) =
|
|||
blockToLaTeX (Table caption aligns widths heads rows) = do
|
||||
headers <- if all null heads
|
||||
then return empty
|
||||
else ($$ "\\hline\\noalign{\\medskip}") `fmap`
|
||||
else ($$ "\\midrule\\endhead") `fmap`
|
||||
(tableRowToLaTeX True aligns widths) heads
|
||||
captionText <- inlineListToLaTeX caption
|
||||
let capt = if isEmpty captionText
|
||||
then empty
|
||||
else text "\\noalign{\\medskip}"
|
||||
else text "\\addlinespace"
|
||||
$$ text "\\caption" <> braces captionText
|
||||
rows' <- mapM (tableRowToLaTeX False aligns widths) rows
|
||||
let colDescriptors = text $ concat $ map toColDescriptor aligns
|
||||
|
@ -466,10 +466,10 @@ blockToLaTeX (Table caption aligns widths heads rows) = do
|
|||
return $ "\\begin{longtable}[c]" <>
|
||||
braces ("@{}" <> colDescriptors <> "@{}")
|
||||
-- the @{} removes extra space at beginning and end
|
||||
$$ "\\hline\\noalign{\\medskip}"
|
||||
$$ "\\toprule\\addlinespace"
|
||||
$$ headers
|
||||
$$ vcat rows'
|
||||
$$ "\\hline"
|
||||
$$ "\\bottomrule"
|
||||
$$ capt
|
||||
$$ "\\end{longtable}"
|
||||
|
||||
|
@ -506,7 +506,7 @@ tableRowToLaTeX header aligns widths cols = do
|
|||
(w * scaleFactor))) <>
|
||||
(halign a <> cr <> c <> cr) <> "\\end{minipage}"
|
||||
let cells = zipWith3 toCell widths aligns renderedCells
|
||||
return $ hsep (intersperse "&" cells) $$ "\\\\\\noalign{\\medskip}"
|
||||
return $ hsep (intersperse "&" cells) $$ "\\\\\\addlinespace"
|
||||
|
||||
listItemToLaTeX :: [Block] -> State WriterState Doc
|
||||
listItemToLaTeX lst = blockListToLaTeX lst >>= return . (text "\\item" $$) .
|
||||
|
|
|
@ -1,59 +1,59 @@
|
|||
Simple table with caption:
|
||||
|
||||
\begin{longtable}[c]{@{}rlcl@{}}
|
||||
\hline\noalign{\medskip}
|
||||
\toprule\addlinespace
|
||||
Right & Left & Center & Default
|
||||
\\\noalign{\medskip}
|
||||
\hline\noalign{\medskip}
|
||||
\\\addlinespace
|
||||
\midrule\endhead
|
||||
12 & 12 & 12 & 12
|
||||
\\\noalign{\medskip}
|
||||
\\\addlinespace
|
||||
123 & 123 & 123 & 123
|
||||
\\\noalign{\medskip}
|
||||
\\\addlinespace
|
||||
1 & 1 & 1 & 1
|
||||
\\\noalign{\medskip}
|
||||
\hline
|
||||
\noalign{\medskip}
|
||||
\\\addlinespace
|
||||
\bottomrule
|
||||
\addlinespace
|
||||
\caption{Demonstration of simple table syntax.}
|
||||
\end{longtable}
|
||||
|
||||
Simple table without caption:
|
||||
|
||||
\begin{longtable}[c]{@{}rlcl@{}}
|
||||
\hline\noalign{\medskip}
|
||||
\toprule\addlinespace
|
||||
Right & Left & Center & Default
|
||||
\\\noalign{\medskip}
|
||||
\hline\noalign{\medskip}
|
||||
\\\addlinespace
|
||||
\midrule\endhead
|
||||
12 & 12 & 12 & 12
|
||||
\\\noalign{\medskip}
|
||||
\\\addlinespace
|
||||
123 & 123 & 123 & 123
|
||||
\\\noalign{\medskip}
|
||||
\\\addlinespace
|
||||
1 & 1 & 1 & 1
|
||||
\\\noalign{\medskip}
|
||||
\hline
|
||||
\\\addlinespace
|
||||
\bottomrule
|
||||
\end{longtable}
|
||||
|
||||
Simple table indented two spaces:
|
||||
|
||||
\begin{longtable}[c]{@{}rlcl@{}}
|
||||
\hline\noalign{\medskip}
|
||||
\toprule\addlinespace
|
||||
Right & Left & Center & Default
|
||||
\\\noalign{\medskip}
|
||||
\hline\noalign{\medskip}
|
||||
\\\addlinespace
|
||||
\midrule\endhead
|
||||
12 & 12 & 12 & 12
|
||||
\\\noalign{\medskip}
|
||||
\\\addlinespace
|
||||
123 & 123 & 123 & 123
|
||||
\\\noalign{\medskip}
|
||||
\\\addlinespace
|
||||
1 & 1 & 1 & 1
|
||||
\\\noalign{\medskip}
|
||||
\hline
|
||||
\noalign{\medskip}
|
||||
\\\addlinespace
|
||||
\bottomrule
|
||||
\addlinespace
|
||||
\caption{Demonstration of simple table syntax.}
|
||||
\end{longtable}
|
||||
|
||||
Multiline table with caption:
|
||||
|
||||
\begin{longtable}[c]{@{}clrl@{}}
|
||||
\hline\noalign{\medskip}
|
||||
\toprule\addlinespace
|
||||
\begin{minipage}[b]{0.13\columnwidth}\centering
|
||||
Centered Header
|
||||
\end{minipage} & \begin{minipage}[b]{0.12\columnwidth}\raggedright
|
||||
|
@ -63,8 +63,8 @@ Right Aligned
|
|||
\end{minipage} & \begin{minipage}[b]{0.30\columnwidth}\raggedright
|
||||
Default aligned
|
||||
\end{minipage}
|
||||
\\\noalign{\medskip}
|
||||
\hline\noalign{\medskip}
|
||||
\\\addlinespace
|
||||
\midrule\endhead
|
||||
\begin{minipage}[t]{0.13\columnwidth}\centering
|
||||
First
|
||||
\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright
|
||||
|
@ -74,7 +74,7 @@ row
|
|||
\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright
|
||||
Example of a row that spans multiple lines.
|
||||
\end{minipage}
|
||||
\\\noalign{\medskip}
|
||||
\\\addlinespace
|
||||
\begin{minipage}[t]{0.13\columnwidth}\centering
|
||||
Second
|
||||
\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright
|
||||
|
@ -84,16 +84,16 @@ row
|
|||
\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright
|
||||
Here's another one. Note the blank line between rows.
|
||||
\end{minipage}
|
||||
\\\noalign{\medskip}
|
||||
\hline
|
||||
\noalign{\medskip}
|
||||
\\\addlinespace
|
||||
\bottomrule
|
||||
\addlinespace
|
||||
\caption{Here's the caption. It may span multiple lines.}
|
||||
\end{longtable}
|
||||
|
||||
Multiline table without caption:
|
||||
|
||||
\begin{longtable}[c]{@{}clrl@{}}
|
||||
\hline\noalign{\medskip}
|
||||
\toprule\addlinespace
|
||||
\begin{minipage}[b]{0.13\columnwidth}\centering
|
||||
Centered Header
|
||||
\end{minipage} & \begin{minipage}[b]{0.12\columnwidth}\raggedright
|
||||
|
@ -103,8 +103,8 @@ Right Aligned
|
|||
\end{minipage} & \begin{minipage}[b]{0.30\columnwidth}\raggedright
|
||||
Default aligned
|
||||
\end{minipage}
|
||||
\\\noalign{\medskip}
|
||||
\hline\noalign{\medskip}
|
||||
\\\addlinespace
|
||||
\midrule\endhead
|
||||
\begin{minipage}[t]{0.13\columnwidth}\centering
|
||||
First
|
||||
\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright
|
||||
|
@ -114,7 +114,7 @@ row
|
|||
\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright
|
||||
Example of a row that spans multiple lines.
|
||||
\end{minipage}
|
||||
\\\noalign{\medskip}
|
||||
\\\addlinespace
|
||||
\begin{minipage}[t]{0.13\columnwidth}\centering
|
||||
Second
|
||||
\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright
|
||||
|
@ -124,27 +124,27 @@ row
|
|||
\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright
|
||||
Here's another one. Note the blank line between rows.
|
||||
\end{minipage}
|
||||
\\\noalign{\medskip}
|
||||
\hline
|
||||
\\\addlinespace
|
||||
\bottomrule
|
||||
\end{longtable}
|
||||
|
||||
Table without column headers:
|
||||
|
||||
\begin{longtable}[c]{@{}rlcr@{}}
|
||||
\hline\noalign{\medskip}
|
||||
\toprule\addlinespace
|
||||
12 & 12 & 12 & 12
|
||||
\\\noalign{\medskip}
|
||||
\\\addlinespace
|
||||
123 & 123 & 123 & 123
|
||||
\\\noalign{\medskip}
|
||||
\\\addlinespace
|
||||
1 & 1 & 1 & 1
|
||||
\\\noalign{\medskip}
|
||||
\hline
|
||||
\\\addlinespace
|
||||
\bottomrule
|
||||
\end{longtable}
|
||||
|
||||
Multiline table without column headers:
|
||||
|
||||
\begin{longtable}[c]{@{}clrl@{}}
|
||||
\hline\noalign{\medskip}
|
||||
\toprule\addlinespace
|
||||
\begin{minipage}[t]{0.13\columnwidth}\centering
|
||||
First
|
||||
\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright
|
||||
|
@ -154,7 +154,7 @@ row
|
|||
\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright
|
||||
Example of a row that spans multiple lines.
|
||||
\end{minipage}
|
||||
\\\noalign{\medskip}
|
||||
\\\addlinespace
|
||||
\begin{minipage}[t]{0.13\columnwidth}\centering
|
||||
Second
|
||||
\end{minipage} & \begin{minipage}[t]{0.12\columnwidth}\raggedright
|
||||
|
@ -164,6 +164,6 @@ row
|
|||
\end{minipage} & \begin{minipage}[t]{0.30\columnwidth}\raggedright
|
||||
Here's another one. Note the blank line between rows.
|
||||
\end{minipage}
|
||||
\\\noalign{\medskip}
|
||||
\hline
|
||||
\\\addlinespace
|
||||
\bottomrule
|
||||
\end{longtable}
|
||||
|
|
Loading…
Reference in a new issue