diff options
Diffstat (limited to 'Master/texmf-dist/doc/luatex/lutabulartools/lutabulartools.tex')
-rw-r--r-- | Master/texmf-dist/doc/luatex/lutabulartools/lutabulartools.tex | 85 |
1 files changed, 56 insertions, 29 deletions
diff --git a/Master/texmf-dist/doc/luatex/lutabulartools/lutabulartools.tex b/Master/texmf-dist/doc/luatex/lutabulartools/lutabulartools.tex index 97802fce072..7af9cbc4a66 100644 --- a/Master/texmf-dist/doc/luatex/lutabulartools/lutabulartools.tex +++ b/Master/texmf-dist/doc/luatex/lutabulartools/lutabulartools.tex @@ -1,5 +1,5 @@ % Kale Ewasiuk (kalekje@gmail.com) -% 2022-10-22 +% 2022-11-27 % Copyright (C) 2021-2022 Kale Ewasiuk % % Permission is hereby granted, free of charge, to any person obtaining a copy @@ -101,22 +101,21 @@ The following packages are loaded if not already, so if you have specific settin {xcolor}, {colortbl}, {luacode}, -{penlight}, -} +{penlight} +}. -\section{Options} -The author likes tables with left and right-most columns flush to the end. -Since the \cmd{tabular} env is redefined in this, the author took the liberty to -automatically pad the \cmd{tabular} cell spec with \cmd{@{}} on each end. -If you don't want this, you can pass \cmd{notrim} to the package. Or, -you can manually fix it in a \cmd{tabular} with \cmd{!{}} like so: +\section{settabular} +A key-val interface in the \cmd{\settabular{}} command is used to set some tabular settings. +\cmd{nopad} automatically adds \cmd{@{}} on each end of the column spec.\\ +\cmd{tbrule} automatically adds \cmd{\toprule} as the first thing in the environment, and \cmd{\bottomrule} as the last. +Note that automatic rule adding is disabled in \cmd{longtable}. \begin{LTXexample} -\begin{tabular}{!{}c!{}}\toprule -Xyz\\\bottomrule \end{tabular} +\settabular{nopad,tbrule} % or +\settabular{nopad=false,tbrule=false} \end{LTXexample} -\subsection{Debugging} +\section{Debugging} You can toggle log output debugging with \cmd{\lttdebugON} and \cmd{\lttdebugOFF}. The messages will be printed in a format like so: \begin{verbatim} @@ -132,7 +131,7 @@ With the help of LuaLaTeX, it takes an easy-to-use cell specification and employ \cmd{\MC} will not work properly if your table is only 1 column wide (you probably don't need \cmd{MC} in that case anyway...). Here is the usage: -\texttt{\textbackslash MC * [cell spec] <cell format> (override multicolumn col) \{contents\} } +\texttt{\textbackslash MC * [cell spec] [override multicol] <cell format> (add cmidrule) \{contents\} } \llcmd{*}This will wrap the entire command in \{\}. This is necessary for \texttt{siunitx} single-column width columns. However, the \cmd{\MC} command attempts to detect this automatically. @@ -166,16 +165,20 @@ In any of these examples, you can place the alignment letters anywhere. So, \cmd{\MC[l1,2b]} and \cmd{\MC[1,2 lb]} are both left-bottom aligned (spaces are ignored). -\llcmd{(override}% +\llcmd{[override mc]}% You may want to adjust the column specification of a multicolumn cell,\\ -\llcmd{multicolumn)}for example, using -\texttt{(@\{\}c@\{\})} to remove padding between the cell. +\texttt{[@\{\}c@\{\}]} for example to remove padding between the cell. +\llcmd{(cmidrule)} will add a cmidrule at end of row. \cmd{()} to add without trim or \cmd{(lr)} to trim. \llcmd{<cell format>}% You can place formatting like \cmd{\bfseries} here. +\subsection{midrulesat} +If you'd rather specify the location of midrules outside the table, use \cmd{\midrulesat{1,2,3}}: a midrule will be +placed on rows 1, 2, and 3, for the next table only. + \subsection{Defaults}\label{s.def} The \cmd{tabular[*]} environment is re-defined to use Lua pattern matching to parse the column specification of the table. This is done to determine how many columns there are, @@ -195,24 +198,50 @@ S is included by default. \let\nl\\ +Change the settings for the rest of the doc. + + +\begin{LTXexample} +\settabular{nopad,tbrule} +\end{LTXexample} + +\settabular{nopad,tbrule} + + \subsubsection{A good use for headers} + \begin{LTXexample} -\begin{tabular}{ l l l }\toprule +\begin{tabular}{ l l l } \MC[+m]<\itshape>{A Decent Example}\\\midrule - & \MC[2m]{Heading} \\\cmidrule{2-} -\MC[b,-2]{Multi\\Line} & A & B \\\midrule + & \MC[2m](r){Heading} \\ +\MC[b,-2]{Multi\\Line} & A & B \\\midrule + end & & \\ \end{tabular} \end{LTXexample} + + \subsubsection{A small example} +\begin{LTXexample} +\midrulesat{1,2,3} +\begin{tabular}{ l l l } +a \\ +b \\ +c \\ +d \\ +\end{tabular} +\end{LTXexample} + +\subsubsection{A small example} \begin{LTXexample} \begin{tabular}{ l l l }\midrule - A & \MC[mc2,2]{Lttrs} \\ - B & \\ - 1 & A & B \\ + \MC(){A} & \MC[mc2,2]{Lttrs} \\ + \MC(r){B} & \\ \cmidrule{2-3} + \MC(r){1} & \MC(r){A} & \MC(r){B} \\ % todo must fix + \\ \end{tabular} \end{LTXexample} @@ -221,7 +250,7 @@ S is included by default. Notice that the top-aligned p-column doesn't play particularly well with the middle aligned \cmd{\MC} \begin{LTXexample} -\begin{tabular}{ p{1cm} l }\toprule +\begin{tabular}{ p{1cm} l } hello\newline world & \MC[mr]{11\\2} \\ \end{tabular} @@ -232,9 +261,9 @@ doesn't play particularly well with the middle aligned \cmd{\MC} \begin{LTXexample} \begin{tabular}{|c|c|c|} \hline 1 & 2 & 3\\\hline -4 & \MC[2,2cm](@{}c@{}|)% +4 & \MC[2,2cm][@{}c@{}|]% <\ttfamily>{5}\\\cline{1-1} - & \MC[2](r|){} \\\hline%hacky fix + & \MC[2][r|]{} \\\hline%hacky fix 6 & 7 & 8\\\hline \end{tabular} \end{LTXexample} @@ -258,7 +287,7 @@ doesn't play particularly well with the middle aligned \cmd{\MC} \begin{tabular}{| c | c | c | c | c | c |}\toprule \MC[2,2cm]<\ttfamily>{2,2cm} & \MC[2r]<\ttfamily>{2r} & 5 & \MC[,2b]<\ttfamily>{,2b}\\ & & 3 & 4 & 5 & \\\midrule - 1 & 2 & \MC[2l](@{}l)<\ttfamily>{2l (\@\{\}l)} & 5 & 6666\\\cmidrule{3-4} + 1 & 2 & \MC[2l][@{}l]<\ttfamily>{2l (\@\{\}l)} & 5 & 6666\\\cmidrule{3-4} 1 & \MC[+r]<\ttfamily>{+r} \\ \\ 1 & 2 & 3 & 4 & 5 & \MC[,-2]<\ttfamily>{,\\-2}\\ @@ -369,8 +398,7 @@ Note that \cmd{\resetmidruleX} resets the row counter to 0, and is in effect, a \begin{LTXexample} \setmidruleX{step=3,rule=gmidrule} \begin{tabular}{rclc@{\midruleX}} - % ^^^ inject midrule -\toprule + % ^^^ inject midruleX Num & . & . & . \\ \midrule\resetmidruleX % reset so header dont count @@ -388,7 +416,6 @@ Num & . & . & . \\ \resetmidruleX % resest % so no bottom gray rule 12 & & & \\ -\bottomrule \end{tabular} \end{LTXexample} |