parent
bf5edd9f02
commit
18484cbf47
3 changed files with 11 additions and 16 deletions
|
@ -330,20 +330,15 @@ multicolumnDescriptor align
|
|||
width = sum $ NonEmpty.map toWidth colWidths
|
||||
|
||||
-- no column separators at beginning of first and end of last column.
|
||||
numseps = (case colnum + 1 of
|
||||
1 -> 0 -- Not sure why this case is needed (tarleb)
|
||||
_ -> -- the final cell has only one tabcolsep
|
||||
if colnum + colspan == numcols
|
||||
then 1
|
||||
else 2) :: Int
|
||||
skipColSep = "@{}" :: String
|
||||
in T.pack $
|
||||
printf "%s>{%s\\arraybackslash}p{%0.4f\\columnwidth - %d\\tabcolsep}%s"
|
||||
printf "%s>{%s\\arraybackslash}p{(\\columnwidth - %d\\tabcolsep) * \\real{%0.4f} + %d\\tabcolsep}%s"
|
||||
(if colnum == 0 then skipColSep else "")
|
||||
(T.unpack (alignCommand align))
|
||||
(2 * (numcols - 1))
|
||||
width
|
||||
numseps
|
||||
(if colnum + colspan == numcols then skipColSep else "")
|
||||
(2 * (colspan - 1))
|
||||
(if colnum + colspan >= numcols then skipColSep else "")
|
||||
|
||||
-- | Perform a conversion, assuming that the context is a minipage.
|
||||
inMinipage :: Monad m => LW m a -> LW m a
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
\begin{longtable}[]{@{}cclrrrrrrrrl@{}}
|
||||
\caption{Data about the planets of our solar system.}\tabularnewline
|
||||
\toprule()
|
||||
\multicolumn{2}{@{}>{\centering\arraybackslash}p{0.0000\columnwidth - 0\tabcolsep}}{%
|
||||
\multicolumn{2}{@{}>{\centering\arraybackslash}p{(\columnwidth - 22\tabcolsep) * \real{0.0000} + 2\tabcolsep}}{%
|
||||
} & Name & Mass (10\^{}24kg) & Diameter (km) & Density (kg/m\^{}3) & Gravity
|
||||
(m/s\^{}2) & Length of day (hours) & Distance from Sun (10\^{}6km) & Mean
|
||||
temperature (C) & Number of moons & Notes \\
|
||||
\midrule()
|
||||
\endfirsthead
|
||||
\toprule()
|
||||
\multicolumn{2}{@{}>{\centering\arraybackslash}p{0.0000\columnwidth - 0\tabcolsep}}{%
|
||||
\multicolumn{2}{@{}>{\centering\arraybackslash}p{(\columnwidth - 22\tabcolsep) * \real{0.0000} + 2\tabcolsep}}{%
|
||||
} & Name & Mass (10\^{}24kg) & Diameter (km) & Density (kg/m\^{}3) & Gravity
|
||||
(m/s\^{}2) & Length of day (hours) & Distance from Sun (10\^{}6km) & Mean
|
||||
temperature (C) & Number of moons & Notes \\
|
||||
\midrule()
|
||||
\endhead
|
||||
\multicolumn{2}{@{}>{\centering\arraybackslash}p{0.0000\columnwidth - 0\tabcolsep}}{%
|
||||
\multicolumn{2}{@{}>{\centering\arraybackslash}p{(\columnwidth - 22\tabcolsep) * \real{0.0000} + 2\tabcolsep}}{%
|
||||
\multirow{4}{*}{Terrestrial planets}} & Mercury & 0.330 & 4,879 & 5427 & 3.7 &
|
||||
4222.6 & 57.9 & 167 & 0 & Closest to the Sun \\
|
||||
& & Venus & 4.87 & 12,104 & 5243 & 8.9 & 2802.0 & 108.2 & 464 & 0 & \\
|
||||
|
@ -27,7 +27,7 @@ planet \\
|
|||
& \multirow{2}{*}{Ice giants} & Uranus & 86.8 & 51,118 & 1271 & 8.7 & 17.2 &
|
||||
2872.5 & -195 & 27 & \\
|
||||
& & Neptune & 102 & 49,528 & 1638 & 11.0 & 16.1 & 4495.1 & -200 & 14 & \\
|
||||
\multicolumn{2}{@{}>{\centering\arraybackslash}p{0.0000\columnwidth - 0\tabcolsep}}{%
|
||||
\multicolumn{2}{@{}>{\centering\arraybackslash}p{(\columnwidth - 22\tabcolsep) * \real{0.0000} + 2\tabcolsep}}{%
|
||||
Dwarf planets} & Pluto & 0.0146 & 2,370 & 2095 & 0.7 & 153.3 & 5906.4 & -225 & 5
|
||||
& Declassified as a planet in 2006. \\
|
||||
\bottomrule()
|
||||
|
|
|
@ -18,15 +18,15 @@ Name
|
|||
\end{minipage} \\
|
||||
\midrule()
|
||||
\endhead
|
||||
\multicolumn{2}{@{}>{\raggedright\arraybackslash}p{1.0000\columnwidth - 0\tabcolsep}@{}}{%
|
||||
\multicolumn{2}{@{}>{\raggedright\arraybackslash}p{(\columnwidth - 2\tabcolsep) * \real{1.0000} + 2\tabcolsep}@{}}{%
|
||||
Computer Science} \\
|
||||
3741255 & Jones, Martha \\
|
||||
4077830 & Pierce, Benjamin \\
|
||||
5151701 & Kirk, James \\
|
||||
\multicolumn{2}{@{}>{\raggedright\arraybackslash}p{1.0000\columnwidth - 0\tabcolsep}@{}}{%
|
||||
\multicolumn{2}{@{}>{\raggedright\arraybackslash}p{(\columnwidth - 2\tabcolsep) * \real{1.0000} + 2\tabcolsep}@{}}{%
|
||||
Russian Literature} \\
|
||||
3971244 & Nim, Victor \\
|
||||
\multicolumn{2}{@{}>{\raggedright\arraybackslash}p{1.0000\columnwidth - 0\tabcolsep}@{}}{%
|
||||
\multicolumn{2}{@{}>{\raggedright\arraybackslash}p{(\columnwidth - 2\tabcolsep) * \real{1.0000} + 2\tabcolsep}@{}}{%
|
||||
Astrophysics} \\
|
||||
4100332 & Petrov, Alexandra \\
|
||||
4100332 & Toyota, Hiroko \\
|
||||
|
|
Loading…
Add table
Reference in a new issue