diff options
author | Karl Berry <karl@freefriends.org> | 2017-10-07 22:12:24 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2017-10-07 22:12:24 +0000 |
commit | 2fbf92614d7ece5991c30761bf90e7bbf0b6f93e (patch) | |
tree | f2cfda3751473fce80878f05273401d4d2c63f15 /Master/texmf-dist/source/latex/lwarp | |
parent | c394414696e3895403a2f2d599cee160e10d38de (diff) |
lwarp (7oct17)
git-svn-id: svn://tug.org/texlive/trunk@45496 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/lwarp')
-rw-r--r-- | Master/texmf-dist/source/latex/lwarp/lwarp.dtx | 987 |
1 files changed, 786 insertions, 201 deletions
diff --git a/Master/texmf-dist/source/latex/lwarp/lwarp.dtx b/Master/texmf-dist/source/latex/lwarp/lwarp.dtx index 22db6861f1e..92616ef0d2a 100644 --- a/Master/texmf-dist/source/latex/lwarp/lwarp.dtx +++ b/Master/texmf-dist/source/latex/lwarp/lwarp.dtx @@ -16,7 +16,7 @@ % \iffalse %<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<package>\ProvidesPackage{lwarp} -%<package> [2017/09/25 v0.40 Allows LaTeX to directly produce HTML5 output.] +%<package> [2017/10/07 v0.41 Allows LaTeX to directly produce HTML5 output.] % %<*driver> \documentclass{ltxdoc} @@ -301,7 +301,6 @@ Keywords={LaTeX, HTML, conversion}% \par } - \newenvironment{docsidebar}[1][] {% \ifthenelse{\isempty{#1}}{}{\medskip}% @@ -1016,12 +1015,25 @@ or the packages \pkg{multirow}, \pkg{longtable}, \pkg{supertabular}, or \pkg{xta \watchout[\cs{multirow}] This will be a null function for the print output, and is a placeholder for parsing the table for \HTML\ output. + \begin{sourcedisplay} + \small + \begin{tabular}{lll} + \dots\ \& & \cs{multirow}\{2\}\{.5in\}\{text\} & \&\ \dots \\ + \dots\ \& & \textcolor{red}{\cs{mrowcell}} & \&\ \dots \\ + \end{tabular} + \end{sourcedisplay} + Note that recent versions of \pkg{multirow} include a new optional + \margintag{\texttt{vposn}} + \texttt{vposn} argument. \item The \pkg{multirow} documentation regarding colored cells recommends using a negative number of rows. This will not work with \pkg{lwarp}, so \cs{warpprintonly} and \cs{warpHTMLonly} must be used to make versions for print and \HTML. - \item \limitsmulticolumnrow - See \cref{sec:multicolumnmultirow}. + \item + See \cref{sec:multicolumnmultirow} for \cs{multicolumrow}. + + \limitsmulticolumnrow + \item Using a custom macro inside a tabular data cell \watchout[macro in a table]\margintag{custom macros} \index{tabular>row corruption}% @@ -1037,41 +1049,52 @@ or the packages \pkg{multirow}, \pkg{longtable}, \pkg{supertabular}, or \pkg{xta \item [Column specifiers:] \ \begin{itemize} - \item Vertical rules are not yet supported. - \margintag{column types} - \item \texttt{*} in a column specification is not used (so far). \watchout[* column specification] Repeat the column type the correct number of times. - \item Only one each of \texttt{@}, \texttt{!}, \texttt{>}, and \texttt{<} - may be used at each column, and they are used in that order. + \item Only one each of \texttt{@} and \texttt{!} + \margintag{\texttt{@} and \texttt{!}} + is used at each column, and they are used in that order. + + \item In \cs{multirow} cells, the print version may have extra + \margintag{\cs{multirow}} + instances of \texttt{\textless}, \texttt{\textgreater}, \texttt{@}, + and \texttt{!} cells on the second and later rows in the \cs{multirow} + which do not appear in the \HTML\ version. \item \cs{newcolumntype} is ignored; unknown column types are set to \texttt{l}. + \watchout[\cs{newcolumntype}] \end{itemize} \item [Rules:] \ \begin{itemize} - \item If a multirow reaches to the bottom of a table, - and \cs{bottomrule} does not go over to that edge, - \margintag{\cs{multirow} with rules} - try adding a line of empty cells below the \cs{bottomrule}. - (This may be a browser bug.) - \changes{v0.19}{2016/05/28}{Docs: \env{multirow} browser bug workaround.} - - \item If a \cs{midrule} is desired after the last row, - \margintag{rule at last row} - an additional row of blank cells must be used. - - \item \cs{cmidrule} does not support width or trim options - due to \CSS\ limitations. - \margintag{\cs{cmidrule} width, trim} - - \item \cs{cmidrule} borders are generated by the individual cells - \margintag{\cs{cmidrule} and \cs{multicolumn}} - on the following row, - and so do not necessarily work correctly when the following row - has \cs{multicolumn} cells below \cs{cmidrule} borders. + \item Vertical rules next to either side of an \texttt{@} or \texttt{!} column + \margintag{vertical rules} + are displayed on both sides of the column. + + \item Width options are honored. Trim options are converted to + \margintag{width and trim} + rounded top corners. + Trim corners are not rounded with \texttt{@} or \texttt{!} columns, + and full-width rules ignore trim. + + \item \cs{toprule}, \cs{midrule}, \cs{bottomrule}, and \cs{hline} + \margintag{full-width rules} + ignore trim. When given an optional width, each cell is styled + to create the custom border. Without an optional width, the entire + row is given a class to assign the standard border. + + \item If you wish to use \cs{cmidrule} followed by \cs{bottomrule}, + \margintag{combined rules} + it may be necessary to use: + \begin{sourcedisplay} + \cs{cmidrule}\{2-3\} \textbackslash\textbackslash[-2ex] \\ + \cs{bottomrule} + \end{sourcedisplay} + The optional \texttt{-2ex} is ignored in \HTML\, but improves the + visual formatting in the print output. + \item For \cs{toprule} and \cs{bottomrule}, \watchout[\cs{warpprintonly}] when combined with a \env{warpprint} or \env{warpHTML} environment, @@ -1115,17 +1138,38 @@ or the packages \pkg{multirow}, \pkg{longtable}, \pkg{supertabular}, or \pkg{xta } \newcommand{\limitsmulticolumnrow}{% -\pkg{lwarp} does not support combining \cs{multicolumn} and \cs{multirow}. +\pkg{lwarp} does not support \watchout[\cs{multicolumn} \& \cs{multirow}] +directly combining \cs{multicolumn} and \cs{multirow}. Use \cs{multicolumnrow} instead. To create a 2 column, 3 row cell: \begin{sourcedisplay} -\cs{multicolumnrow}\{2\}\{c\}[c]\{3\}[0]\{1in\}[0pt]\{Text\} +\cs{multicolumnrow}% + \textcolor{blue}{\{2\}\{c\}}% + \textcolor{green!50!black}{[c]\{3\}[0]\{1in\}[0pt]}\{Text\} \end{sourcedisplay} The two arguments for \cs{multicolumn} come first, followed by the five arguments for \cs{multirow}, many of which are optional, followed by the contents. + +As per \cs{multirow}, +\watchout[skipped cells] +skipped cells to the right of the \cs{multicolumnrow} +statement are not included in the source code on the same line. +On the following lines, \cs{mcolrowcell} must be used for each cell +\watchout[empty cells] +of each column and each row to be skipped: +\begin{sourcedisplay} +\small +\begin{tabular}{lll} +\dots\ \& & \cs{multicolumnrow}\{2\}\{c\}[c]\{3\}[0]\{1in\}[0pt]\{Text\} & \&\ \dots \\ +\dots\ \& & \textcolor{red}{\cs{mcolrowcell}} \hfill \& \hfill \textcolor{red}{\cs{mcolrowcell}} & \&\ \dots \\ +\dots\ \& & \textcolor{red}{\cs{mcolrowcell}} \hfill \& \hfill \textcolor{red}{\cs{mcolrowcell}} & \&\ \dots \\ +\end{tabular} +\end{sourcedisplay} + Note that recent versions of \pkg{multirow} include a new optional +\margintag{\texttt{vposn}} \texttt{vposn} argument. } @@ -1551,7 +1595,7 @@ This boolean may be tested by the user for later use. %<*package> % \fi % -% \CheckSum{14147} +% \CheckSum{14314} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -1633,6 +1677,7 @@ This boolean may be tested by the user for later use. % \changes{v0.38}{2017/08/27}{\ 2017/08/27} % \changes{v0.39}{2017/09/05}{\ 2017/09/05} % \changes{v0.40}{2017/09/25}{\ 2017/09/25} +% \changes{v0.41}{2017/10/07}{\ 2017/10/07} @@ -1767,6 +1812,23 @@ This boolean may be tested by the user for later use. % For a detailed list of changes, see the Change History on page \pageref{sec:changehistory}. % % \begin{description} +% \item[v0.41:] \ +% \begin{itemize} +% \item Added tabular vertical rules, subject to some limitations. +% \margintag{\env{tabular}} +% See the rules section of \cref{sec:limitstabular}. +% \item Improved \pkg{booktabs}: Width and trim are honored. +% \item Added \cs{mcolrowcell} for empty cells inside a \cs{multicolumnrow}. +% \watchout[new syntax] +% \textcolor{red}{Use \cs{mcolrowcell} instead of \cs{mrowcell} for two-dimensional +% cells created by \cs{multicolumnrow}.} +% Continue to use \cs{mrowcell} for empty cells in a \cs{multirow}. +% See \cref{sec:multicolumnmultirow} on \cpageref{sec:multicolumnmultirow}. +% \item Fix: Unfinished tabular rows are automatically filled. +% \item Fix for tabular column specifiers while using \pkg{babel-french}. +% (\cs{NoAutoSpacing} is activated then nullified inside the tabular, +% due to a conflict with the tabular column parsing code.) +% \end{itemize} % \item[v0.40:] \ % \begin{itemize} % \item \pkg{graphics} and \pkg{graphicx} have been moved from the @@ -8204,15 +8266,15 @@ figure div.floatrow div.minipage figcaption { table { margin: 1ex auto 1ex auto ; - border-collapse: collapse ; + border-collapse: separate ; border-spacing: 0px ; line-height: 1.3 ; } -tr.hline {border-top: 1px solid silver ; margin-top: 0ex ; +tr.hline td {border-top: 1px solid #808080 ; margin-top: 0ex ; margin-bottom: 0ex ; } /* for \hline */ -tr.tbrule {border-top: 1px solid black ; margin-top: 0ex ; +tr.tbrule td {border-top: 1px solid black ; margin-top: 0ex ; margin-bottom: 0ex ; } /* for \toprule, \bottomrule */ td {padding: 1ex .5em 1ex .5em ;} @@ -8228,28 +8290,32 @@ table td.tdb { text-align: left ; vertical-align: top ; } table td.tdP { text-align: center ; vertical-align: bottom ; } table td.tdM { text-align: center ; vertical-align: middle ; } table td.tdB { text-align: center ; vertical-align: top ; } -table td.tdlrule { text-align: left ; border-top: 1px solid silver ; - vertical-align: middle ; } /* for cmidrule */ -table td.tdcrule { text-align: center ; border-top: 1px solid silver ; - vertical-align: middle ; } -table td.tdatrule { text-align: center ; border-top: 1px solid silver ; - vertical-align: middle ; padding: 0px ; margin: 0px ; } -table td.tdbangrule { text-align: center ; border-top: 1px solid silver ; - vertical-align: middle ; } /* for cmidrule */ -table td.tdrrule { text-align: right ; border-top: 1px solid silver ; - vertical-align: middle ; } -table td.tdprule { text-align: left ; border-top: 1px solid silver ; - vertical-align: bottom ; } -table td.tdmrule { text-align: left ; border-top: 1px solid silver ; - vertical-align: middle ; } -table td.tdbrule { text-align: left ; border-top: 1px solid silver ; - vertical-align: top ; } -table td.tdPrule { text-align: center ; border-top: 1px solid silver ; - vertical-align: bottom ; } -table td.tdMrule { text-align: center ; border-top: 1px solid silver ; - vertical-align: middle ; } -table td.tdBrule { text-align: center ; border-top: 1px solid silver ; - vertical-align: top ; } + +table td.tvertbarl { border-left: 1px solid black } +table td.tvertbarr { border-right: 1px solid black } + + +/* for cmidrules: */ +table td.tdrule { + border-top: 1px solid #A0A0A0 ; +} + +table td.tdrulel { + border-top-left-radius:.5em ; + border-top: 1px solid #A0A0A0 ; +} + +table td.tdruler { + border-top-right-radius:.5em ; + border-top: 1px solid #A0A0A0 ; +} + +table td.tdrulelr { + border-top-left-radius:.5em ; + border-top-right-radius:.5em ; + border-top: 1px solid #A0A0A0 ; +} + /* Margins of paragraphs inside table cells: */ td.tdp p , td.tdprule p , td.tdP p , td.tdPrule p { padding-top: 1ex ; @@ -9394,7 +9460,7 @@ src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX- -- Print the usage of the lwarpmk command: -printversion = "v0.40" +printversion = "v0.41" function printhelp () print ("lwarpmk: Use lwarpmk -h or lwarpmk --help for help.") ; @@ -10647,50 +10713,53 @@ end -- not --version % \begin{macrocode} \providecommand*{\LWR@FBcancel}{} -\AtBeginDocument{ -\@ifundefined{frenchbsetup} -{} -{ - \frenchbsetup{FrenchFootnotes=false} - % OR: redefine \insertfootnotemarkFB? - \LetLtxMacro\LWR@FBcancel\NoAutoSpacing +\AtBeginDocument{% +\@ifundefined{frenchbsetup}% +{}% +{% + \frenchbsetup{FrenchFootnotes=false}% +% \end{macrocode} +% ^^A OR: redefine \insertfootnotemarkFB? +% \begin{macrocode} +% + \LetLtxMacro\LWR@FBcancel\NoAutoSpacing% \renewcommand*{\FBcolonspace}{% \begingroup% \LWR@FBcancel% \LWR@origampersand{}nbsp;% \endgroup% - } + }% \renewcommand*{\FBthinspace}{% \begingroup% \LWR@FBcancel% \LWR@origampersand\#x202f;% \, \endgroup% - } + }% \renewcommand*{\FBguillspace}{% \begingroup% \LWR@FBcancel% \LWR@origampersand{}nbsp;% ~, for \og xyz \fg{} \endgroup% - } + }% \DeclareDocumentCommand{\FBmedkern}{}{% \begingroup% \LWR@FBcancel% \LWR@origampersand\#x202f;% \, \endgroup% - } + }% \DeclareDocumentCommand{\FBthickkern}{}{% \begingroup% \LWR@FBcancel% \LWR@origampersand{}nbsp;% ~ \endgroup% - } + }% \renewcommand*{~}{\HTMLentity{nbsp}}% was overwritten by babel-french - \ifFBunicode - \else - \DeclareTextSymbol{\FBtextellipsis}{LY1}{133} - \DeclareTextCommandDefault{\FBtextellipsis}{\textellipsis\xspace} - \fi -} + \ifFBunicode% + \else% + \DeclareTextSymbol{\FBtextellipsis}{LY1}{133}% + \DeclareTextCommandDefault{\FBtextellipsis}{\textellipsis\xspace}% + \fi% +}% } % \end{macrocode} @@ -14558,7 +14627,8 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % \end{macrocode} % \DescribeBoolean{LWR@doinghline} -% True if the next row will have an hline above it. +% True if the next row will have an hline or midrule above it. +% Also used for \cs{midrule}. % \begin{macrocode} \newbool{LWR@doinghline} \boolfalse{LWR@doinghline} @@ -14571,6 +14641,16 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% \boolfalse{LWR@doingtbrule} % \end{macrocode} +% \DescribeBoolean{LWR@doingcmidrule} +% True if the next row will have a cmidrule above it. +% +% This is used by \cs{LWR@tabularfinishrow} to force a final empty row +% to create the border for the \cs{cmidrule}. +% \begin{macrocode} +\newbool{LWR@doingcmidrule} +\boolfalse{LWR@doingcmidrule} +% \end{macrocode} + % \DescribeBoolean{LWR@tableparcell} % True if are handling a paragraph inside a table cell, % so must close the paragraph tag before moving on. @@ -14579,21 +14659,36 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % \end{macrocode} % \DescribeBoolean{LWR@skippingmrowcell} -% True if are doing an empty multi-row cell, +% True if are doing an empty \cs{multirow} cell, % and thus there is no data tag to close. % \begin{macrocode} \newbool{LWR@skippingmrowcell} % \end{macrocode} +% \DescribeBoolean{LWR@skippingmcolrowcell} +% True if are doing an empty \cs{multicolumnrow} cell, +% and thus there is no data tag to close, and +% do not print |@| and |!| columns. +% \begin{macrocode} +\newbool{LWR@skippingmcolrowcell} +% \end{macrocode} + % \DescribeBoolean{LWR@skipatbang} -% True if just finished a \cs{multicolumn} so should not print the trailing -% |@| or |!| columns. +% True if just finished a \cs{multicolumn} so should not create the trailing +% |@| or |!| columns table data cells. % \begin{macrocode} \newbool{LWR@skipatbang} % \end{macrocode} +% \DescribeBoolean{LWR@emptyatbang} +% True if finishing a row and should print empty |@| or |!| column table data cells. +% \begin{macrocode} +\newbool{LWR@emptyatbang} +% \end{macrocode} + + % \DescribeBoolean{LWR@intabularmetadata} % True if are in a tabular but not in a data cell. % Used to prevent extra \HTML\ breaks if not inside table data. @@ -14604,7 +14699,7 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% -% \subsection{Handling \&, @, and !} +% \subsection{Handling \&, @, !, and bar} % % \begin{minipage}{\linewidth} % For technical discussion regarding problems redefining |\&|, See: \\ @@ -14613,25 +14708,57 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % \end{minipage} % +% \begin{macro}{\LWR@instertatbangcols} +% \begin{macrocode} +\newcommand*{\LWR@insertatbangcols}{% +\ifbool{LWR@skipatbang}% +{}% +{% + \LWR@printatbang{at}{\theLWR@tablecolspos}% + \LWR@printatbang{bang}{\theLWR@tablecolspos}% +}% +} +% \end{macrocode} +% \end{macro} + + % \begin{macro}{\LWR@closetabledatacell} -% If |LWR@skippingmrowcell| then there is no data tag to close. +% If |LWR@skippingmrowcell| or |LWR@skippingmcolrowcell| then +% there is no data tag to close. % Otherwise, close any paragraphs, then close the data tag. +% +% \changes{v0.41}{2017/10/02}{Add: Mute \protect\texttt{\protect\textgreater} for \cs{bottomrule}.} +% % \begin{macrocode} \newcommand*{\LWR@closetabledatacell}{% \global\booltrue{LWR@intabularmetadata}% \ifbool{LWR@exitingtabular}{}% {% not exiting tabular - \ifbool{LWR@skippingmrowcell}{}% + \ifboolexpr{bool{LWR@skippingmrowcell} or bool{LWR@skippingmcolrowcell}}% + {% +% \end{macrocode} +% If not skipping a \cs{multicolumnrow} cell, +% insert the |@| and |!| columns after this non-existant column. +% \changes{v0.41}{2017/10/03}{Fix: At/bang column with \cs{multirow}.} +% \begin{macrocode} + \ifbool{LWR@skippingmcolrowcell}% + {}% + {\LWR@insertatbangcols}% + }% {% not skippingmrowcell % \end{macrocode} -% Insert any |<| then any |@| and |!| column contents: +% Insert any |<| then any |@| and |!| column contents, unless muted +% for the \cs{bottomrule} or a \cs{multicolumn}: +% \changes{v0.41}{2017/10/02}{Fix: Cancel \protect\texttt{\protect\textless} for \cs{multicolumn}.} % \begin{macrocode} \unskip% - \LWR@getexparray{LWR@colafterspec}{\theLWR@tablecolspos}% -% % \LWR@getexparray{LWR@colatspec}{\theLWR@tablecolspos}% -% \LWR@printatbang{at}{\theLWR@tablecolspos}% -% % \LWR@getexparray{LWR@colbangspec}{\theLWR@tablecolspos}% -% \LWR@printatbang{bang}{\theLWR@tablecolspos}% + \ifboolexpr{% + bool{LWR@tabularmutemods} or + bool{LWR@skipatbang} or + bool{LWR@emptyatbang} + }% + {}% + {\LWR@getexparray{LWR@colafterspec}{\theLWR@tablecolspos}}% % \end{macrocode} % Close paragraphs: % \begin{macrocode} @@ -14642,15 +14769,12 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % Skip the |@| and |!| cells if are closing a multicolumn cell. % \begin{macrocode} \leavevmode\unskip\LWR@htmltag{/td}\LWR@orignewline% - \ifbool{LWR@skipatbang}% - {\boolfalse{LWR@skipatbang}}% - {% - \LWR@printatbang{at}{\theLWR@tablecolspos}% - \LWR@printatbang{bang}{\theLWR@tablecolspos}% - }% not skipping at or bang + \LWR@insertatbangcols% }% not skipping mrowcell }% not exiting tabular \global\boolfalse{LWR@skippingmrowcell}% +\global\boolfalse{LWR@skippingmcolrowcell}% +\global\boolfalse{LWR@skipatbang}% } % \end{macrocode} % \end{macro} @@ -14771,7 +14895,80 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % % |&| is left alone when in math alignments. % \end{macro} + + + +% \subsubsection{Filling an unfinished row} + +% \begin{macro}{\LWR@tabularfinishrow} +% Adds empty table cells if necessary to finish the row. +% +% At the end of the table, if any bottom rules are requested then +% an empty row must be generated to form the borders which show the rules. % +% \changes{v0.41}{2017/10/02}{Unfinished tabular rows automatically filled.} +% +% \begin{macrocode} +\newcommand*{\LWR@tabularfinishrow}{% +% \end{macrocode} +% If not exiting the tabular, or doing a rule, or have already started a row, +% finish this row: +% \begin{macrocode} +\ifboolexpr{% + not bool {LWR@exitingtabular} or% + bool{LWR@doingtbrule} or% + bool{LWR@doingcmidrule} or% + bool{LWR@doinghline} or% + bool{LWR@startedrow}% +}{% +% \end{macrocode} +% To locally temporarily turn off |LWR@exitingtabular| so that +% table data tags will still be generated: +% \begin{macrocode} +\begingroup% +% \end{macrocode} +% If generating a final row for the \cs{bottomrule} borders, +% turn off the |@|, |!|, |<|, and |>| column output: +% \begin{macrocode} +\ifbool{LWR@exitingtabular}{% + \booltrue{LWR@tabularmutemods}% +}{}% +% \end{macrocode} +% Reenable the table data tags until finished with the final row: +% \begin{macrocode} +\boolfalse{LWR@exitingtabular}% +% \end{macrocode} +% Generate table data tags and ampersands until the right edge: +% \begin{macrocode} +\whiledo{\value{LWR@tablecolspos}<\value{LWR@tabletotalcols}}{% +\LWR@tabledatasinglecolumntag% +% \end{macrocode} +% The following is essentially \cs{LWR@tabularampersand} with +% |LWR@emptyatbang| added to empty the following cells: +% \begin{macrocode} + \LWR@closetabledatacell% + \addtocounter{LWR@tablecolspos}{1}% + \global\booltrue{LWR@emptyatbang}% +% \end{macrocode} +% Starts the next cell: +% \begin{macrocode} + \LWR@getmynexttoken% +}% +% \end{macrocode} +% Required to close the final cell: +% \begin{macrocode} +\LWR@closetabledatacell% +% \end{macrocode} +% Reenable the original |LWR@exitingtabular| to close the entire table: +% \begin{macrocode} +\endgroup% +\global\boolfalse{LWR@emptyatbang}% +}{}% ifboolexpr +} +% \end{macrocode} +% \end{macro} + + % \subsection{Handling \protect\textbackslash\protect\textbackslash} @@ -14784,9 +14981,12 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % \begin{macrocode} \NewDocumentCommand{\LWR@tabularendofline}{s o} {% -\LWR@closetabledatacell% -% \end{macrocode} -% Finish the previous row: +\ifthenelse{\value{LWR@tablecolspos}<\value{LWR@tabletotalcols}}{% + \LWR@tabularfinishrow% +}% +{% + \LWR@closetabledatacell% +}% % \begin{macrocode} \LWR@htmltag{/tr}\LWR@orignewline \global\booltrue{LWR@intabularmetadata} @@ -14799,6 +14999,7 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % \begin{macrocode} \global\boolfalse{LWR@doinghline}% \global\boolfalse{LWR@doingtbrule}% +\global\boolfalse{LWR@doingcmidrule}% \LWR@clearmidrules% % \end{macrocode} % Start at first column: @@ -14826,9 +15027,8 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % of total width |LWR@tabletotalcols|, not counting |@| and |!| columns. % % Will contain a string such as |llrrccpc|, exactly one letter per \LaTeX\ table column, -% without |@|, |!|, |>|, |<|, or the vertical pipe. +% without |@|, |!|, |>|, |<|, or the vertical bar. % -% This is indexed by the counter |LWR@tabletotalcols|. % \begin{macrocode} \newcommand*{\LWR@tablecolspec}{} % \end{macrocode} @@ -14869,6 +15069,7 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % \DescribeCounter{LWR@tabletotalcols} % Holds the final number of table columns, not counting |@| and |!| columns. +% This is equal to the number of cells in each row. % \begin{macrocode} \newcounter{LWR@tabletotalcols} % \end{macrocode} @@ -14880,21 +15081,22 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% \newcounter{LWR@tabletotalcolsnext} % \end{macrocode} -% \DescribeObject{LWR@colatspec}A data array of specifications for |@| columns. +% \DescribeObject{LWR@colatspec} A data array of specifications for |@| columns. % The leftmost's index is |leftedge|, the others are counter values. % See \cref{sec:dataarray}. % -% \DescribeObject{LWR@colbangspec}A data array of specifications for |!| columns. +% \DescribeObject{LWR@colbangspec} A data array of specifications for |!| columns. % The leftmost's index is |leftedge|, the others are counter values. % See \cref{sec:dataarray}. % -% \DescribeObject{LWR@colbeforespec}A data array of specifications for |>| columns. +% \DescribeObject{LWR@colbeforespec} A data array of specifications for |>| columns. % -% \DescribeObject{LWR@colafterspec}A data array of specifications for |<| columns. - +% \DescribeObject{LWR@colafterspec} A data array of specifications for |<| columns. +% +% \DescribeObject{LWR@colbarspec} A data array of specifications for vertical rules. -% \subsection{Parsing @, >, <, ! columns} +% \subsection{Parsing @, >, <, !, bar columns} % % % Holds the parsed argument for |@|, |>|, |<|, or |!| columns: @@ -15040,12 +15242,24 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % \end{macrocode} % \end{macro} % -% \begin{macro}{\LWR@parseskipcolumn} % -% Handles columns to skip, such as the vertical bar. +% \begin{macro}{\LWR@parsebarcolumn} \qquad Handles vertical rules. +% +% \changes{v0.41}{2017/10/07}{Added vertical rules.} % % \begin{macrocode} -\newcommand*{\LWR@parseskipcolumn}{% +\newcommand*{\LWR@parsebarcolumn}{% +\LWR@traceinfo{bar column}% +% \end{macrocode} +% Remember the bar at this position: +% \begin{macrocode} +\ifthenelse{\cnttest{\value{LWR@tabletotalcols}}=0}% +{% left edge of the table: + \LWR@setexparray{LWR@colbarspec}{leftedge}{tvertbarl}% +}% +{% not at the left edge: + \LWR@setexparray{LWR@colbarspec}{\theLWR@tabletotalcols}{tvertbarr}% +}% \booltrue{LWR@validtablecol}% } % \end{macrocode} @@ -15068,6 +15282,7 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% \LWR@setexparray{LWR@colbangspec}{\theLWR@tabletotalcolsnext}{}% \LWR@setexparray{LWR@colbeforespec}{\theLWR@tabletotalcolsnext}{}% \LWR@setexparray{LWR@colafterspec}{\theLWR@tabletotalcolsnext}{}% +\LWR@setexparray{LWR@colbarspec}{\theLWR@tabletotalcolsnext}{}% \booltrue{LWR@validtablecol}% } % \end{macrocode} @@ -15198,7 +15413,7 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % Scans the column specification left to right. % % Builds \cs{LWR@tablecolspec} with the final specification, -% one column per entry. The number of final columns is +% one column per entry. The final number of cells in each row is % stored in |LWR@tabletotalcols|. % % \changes{v0.22}{2017/02/28}{Unknown table column types become \texttt{l}. @@ -15238,6 +15453,10 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% \LWR@setexparray{LWR@colafterspec}{1}{}% \LWR@setexparray{LWR@colafterspec}{2}{}% \LWR@setexparray{LWR@colafterspec}{3}{}% +\LWR@setexparray{LWR@colbarspec}{leftedge}{}% +\LWR@setexparray{LWR@colbarspec}{1}{}% +\LWR@setexparray{LWR@colbarspec}{2}{}% +\LWR@setexparray{LWR@colbarspec}{3}{}% % \end{macrocode} % Starting at the first column specification: % \begin{macrocode} @@ -15283,7 +15502,7 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% \IfStrEq{\LWR@strresult}{!}{\LWR@parsebangcolumn}{}% \IfStrEq{\LWR@strresult}{>}{\LWR@parsebeforecolumn}{}% \IfStrEq{\LWR@strresult}{<}{\LWR@parseaftercolumn}{}% -\IfStrEq{\LWR@strresult}{|}{\LWR@parseskipcolumn}{}% +\IfStrEq{\LWR@strresult}{|}{\LWR@parsebarcolumn}{}% \IfStrEq{\LWR@strresult}{p}{\LWR@parsepcolumn{p}}{}% \IfStrEq{\LWR@strresult}{m}{\LWR@parsepcolumn{m}}{}% \IfStrEq{\LWR@strresult}{b}{\LWR@parsepcolumn{b}}{}% @@ -15342,10 +15561,16 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % \begin{macrocode} \global\booltrue{LWR@intabularmetadata}% \ifbool{LWR@doinghline}% - {\LWR@htmltag{tr class="hline"{}}\LWR@orignewline}% + {% + \LWR@htmltag{tr class="hline" }% + \LWR@orignewline% + }% {% not doing hline \ifbool{LWR@doingtbrule}% - {\LWR@htmltag{tr class="tbrule"{}}\LWR@orignewline}% + {% + \LWR@htmltag{tr class="tbrule"}% + \LWR@orignewline% + }% {\LWR@htmltag{tr}\LWR@orignewline}% }% end of not doing hline }% end of not started the row @@ -15354,34 +15579,107 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % \end{macro} +% \subsection{Printing vertical bar tags} + +% \begin{macro}{\LWR@printbartag} \marg{index} +% +% Adds to a tabular data cell an \HTML\ class name for a left/right vertical bar. +% +% \changes{v0.41}{2017/10/07}{Added vertical rules.} +% +% \begin{macrocode} +\newcommand*{\LWR@printbartag}[1]{% +\ifboolexpr{bool{LWR@tabularmutemods} or bool{LWR@emptyatbang}}% +{% +}% +{ % not muting + \ifstrequal{#1}{leftedge}{% + \LWR@getexparray{LWR@colbarspec}{leftedge} % + }% + { + \LWR@getexparray{LWR@colbarspec}{#1} % + \edef\LWR@tempone{\LWR@getexparray{LWR@colbarspec}{#1}}% + } % +}% not muting +} +% \end{macrocode} +% \end{macro} + + % \subsection{Printing at or bang tags} % \begin{macro}{\LWR@printatbang} \marg{at -or- bang} \marg{index} +% +% \changes{v0.41}{2017/09/28}{Add: \cs{cmidrule} trims.} +% \changes{v0.41}{2017/10/02}{Add: Mute at and bang columns for \cs{bottomrule}.} % \begin{macrocode} \newcommand*{\LWR@printatbang}[2]{% -\edef\LWR@atbangspec{\LWR@getexparray{LWR@col#1spec}{#2}} -\LWR@traceinfo{atbang: !\LWR@atbangspec!} +% \end{macrocode} +% Fetch the column at or bang spec: +% \begin{macrocode} +\edef\LWR@atbangspec{\LWR@getexparray{LWR@col#1spec}{#2}}% +\LWR@traceinfo{atbang: #2 !\LWR@atbangspec!}% +% \end{macrocode} +% Only generate if is not empty; +% \begin{macrocode} \ifdefempty{\LWR@atbangspec}% -% \ifthenelse{\isempty{\LWR@atbangspec}}% {}% -{% - \LWR@htmltag{td class="td#1% - \ifthenelse{\equal{\LWR@getexparray{LWR@midrules}{\theLWR@tablecolspos}}{Y}}{rule}{}% - "}% - \LWR@atbangspec% +{% not empty + \LWR@htmltag{% + td class="td#1% + \LWR@subaddcmidruletrim{}{}% + \LWR@printbartag{#2}% + "% + \LWR@addcmidrulewidth% + }% +% \end{macrocode} +% Create an empty cell if muting for the \cs{bottomrule}: +% \begin{macrocode} + \ifboolexpr{bool{LWR@tabularmutemods} or bool{LWR@emptyatbang}}% + {}% + {\LWR@atbangspec}% +% \LWR@htmltag{/td}\LWR@orignewline% -}% +}% not empty }% % \end{macrocode} % \end{macro} +% \begin{macro}{\LWR@addleftmostbartag} +% \begin{macrocode} +\newcommand*{\LWR@addleftmostbartag}{% +\ifnumcomp{\value{LWR@tablecolspos}}{=}{1}{% + \LWR@printbartag{leftedge}% +}{}% +} +% \end{macrocode} +% \end{macro} + + +% \begin{macro}{\LWR@tabularleftedge} +% \begin{macrocode} +\newcommand*{\LWR@tabularleftedge}{% +\ifthenelse{\cnttest{\value{LWR@tablecolspos}}=1}% +{% + \LWR@printatbang{at}{leftedge}% + \LWR@printatbang{bang}{leftedge}% +}% left edge +{}% not left edge +} +% \end{macrocode} +% \end{macro} + + + % \subsection{Data opening tag} % \begin{macro}{\LWR@tabledatasinglecolumntag} % Print a table data opening tag with style for alignment % % \changes{v0.33}{2017/06/22}{Fix: Macros in tabular could cause extra data cell.} +% \changes{v0.41}{2017/09/28}{Add: \cs{cmidrule} trims.} +% \changes{v0.41}{2017/10/02}{Add: Mute \protect\texttt{\protect\textless} for \cs{bottomrule}.} % % \begin{macrocode} \newcommand*{\LWR@tabledatasinglecolumntag}% @@ -15400,12 +15698,7 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % \end{macrocode} % Print the |@| and |!| contents before first column: % \begin{macrocode} - \ifthenelse{\cnttest{\value{LWR@tablecolspos}}=1}% - {% - \LWR@printatbang{at}{leftedge}% - \LWR@printatbang{bang}{leftedge}% - }% left edge - {}% not left edge + \LWR@tabularleftedge% % \end{macrocode} % Fetch the current column's alignment character into |\LWR@strresult|: % \begin{macrocode} @@ -15419,12 +15712,15 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % \begin{macrocode} \LWR@strresult% % \end{macrocode} -% If this column has a cmidrule, add ``rule'' to the end of the \HTML\ class tag: +% If this column has a cmidrule, add ``rule'' to the end of the \HTML\ class tag. +% Also add vertical bar tags. % \begin{macrocode} - \ifthenelse{\equal{\LWR@getexparray{LWR@midrules}{\theLWR@tablecolspos}}{Y}}% - {rule}% - {}% - "{}}% + \LWR@addcmidruletrim% + \LWR@addleftmostbartag% + \LWR@printbartag{\theLWR@tablecolspos}% + "% + \LWR@addcmidrulewidth% + }% % \end{macrocode} % If this is a p, m, b, or X column, allow paragraphs: % \begin{macrocode} @@ -15443,9 +15739,11 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% }% allow pars {}% no pars % \end{macrocode} -% Print the |>| contents: +% Print the |>| contents unless muted for the \cs{bottomrule}: % \begin{macrocode} - \LWR@getexparray{LWR@colbeforespec}{\theLWR@tablecolspos}% + \ifboolexpr{bool{LWR@tabularmutemods} or bool{LWR@emptyatbang}}% + {}% + {\LWR@getexparray{LWR@colbeforespec}{\theLWR@tablecolspos}}% \global\boolfalse{LWR@intabularmetadata}% }% not exiting tabular }{}% in tabular metadata @@ -15457,20 +15755,69 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % \subsection{Midrules} % % \DescribeObject{LWR@midrules}|LWR@midrules| is a data array +% (\cref{sec:dataarray}) of columns each containing a non-zero width +% if a midrule should be created for this column. + +% \DescribeObject{LWR@trimlrules}|LWR@trimlrules| is a data array % (\cref{sec:dataarray}) of columns containing -% |Y| if a midrule should be created for each column. +% |l| if a midrule should be left trimmed for each column. + +% \DescribeObject{LWR@trimrrules}|LWR@trimrrules| is a data array +% (\cref{sec:dataarray}) of columns containing +% |r| if a midrule should be right trimmed for each column. % \DescribeCounter{LWR@midrulecounter} -% Indexes across the |LWR@midrules| data array. +% Indexes across the |LWR@midrules| and |LWR@trim<l/r>rules| data arrays. % \begin{macrocode} \newcounter{LWR@midrulecounter} % \end{macrocode} + + +% \DescribeLength{\LWR@heavyrulewidth} +% The default width of the rule. +% \begin{macrocode} +\newlength{\LWR@heavyrulewidth} +\setlength{\LWR@heavyrulewidth}{.08em} +% \end{macrocode} + + +% \DescribeLength{\LWR@lightrulewidth} +% The default width of the rule. +% \begin{macrocode} +\newlength{\LWR@lightrulewidth} +\setlength{\LWR@lightrulewidth}{.05em} +% \end{macrocode} + + +% \DescribeLength{\LWR@cmidrulewidth} +% The default width of the rule. +% \begin{macrocode} +\newlength{\LWR@cmidrulewidth} +\setlength{\LWR@cmidrulewidth}{.03em} +% \end{macrocode} + + +% \DescribeLength{\LWR@thiscmidrulewidth} +% The width of the next rule, defaulting to \cs{lightrulewidth}. +% +% If not \cs{lightrulewidth}, a style will be used to generate +% the custom width. +% +% Assigned from the |LWR@midrules| array. +% \begin{macrocode} +\newlength{\LWR@thiscmidrulewidth} +\setlength{\LWR@thiscmidrulewidth}{\LWR@cmidrulewidth} +% \end{macrocode} + + % \begin{macro}{\LWR@clearmidrules} % Start new midrules. Called at beginning of tabular and also at |\\|. % -% Clears all |LWR@midrules| markers for this line. +% Clears all |LWR@midrules| and |LWR@trimruels| markers for this line. +% +% \changes{v0.41}{2017/09/28}{Add: \cs{cmidrule} trims.} % \begin{macrocode} \newcommand*{\LWR@clearmidrules} {% @@ -15479,7 +15826,10 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% \cnttest{\value{LWR@midrulecounter}}{<=}{\value{LWR@tablecolswidth}}% }% {% -\LWR@setexparray{LWR@midrules}{\theLWR@midrulecounter}{}% +\LWR@setexparray{LWR@midrules}{\theLWR@midrulecounter}{0pt}% +\setlength{\LWR@thiscmidrulewidth}{\LWR@cmidrulewidth}% +\LWR@setexparray{LWR@trimlrules}{\theLWR@midrulecounter}{}% +\LWR@setexparray{LWR@trimrrules}{\theLWR@midrulecounter}{}% \addtocounter{LWR@midrulecounter}{1}% }% } @@ -15489,15 +15839,26 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % \begin{macro}{\LWR@subcmidrule} \marg{width} \marg{trim} \marg{leftcolumn} \marg{rightcolumn} % -% Marks |LWR@midrules| data array elements to be ``Y'' from left to right columns. +% Marks |LWR@midrules| data array elements to be +% non-zero widths from left to right columns. +% Also marks trimming for the L and/or R columns. +% +% |LWR@doingcmidrule| is set to force an empty row at the end of the tabular +% to create the rule. +% +% \changes{v0.41}{2017/09/28}{Add: \cs{cmidrule} trims.} +% % \begin{macrocode} \newcommand*{\LWR@subcmidrule}[4]{% \setcounter{LWR@midrulecounter}{#3}% \whiledo{\cnttest{\value{LWR@midrulecounter}}{<=}{#4}}% {% -\LWR@setexparray{LWR@midrules}{\theLWR@midrulecounter}{Y}% +\LWR@setexparray{LWR@midrules}{\theLWR@midrulecounter}{#1}% \addtocounter{LWR@midrulecounter}{1}% -}% end of the whiledo +}% whiledo +\IfSubStr{#2}{l}{\LWR@setexparray{LWR@trimlrules}{#3}{l}}{}% +\IfSubStr{#2}{r}{\LWR@setexparray{LWR@trimrrules}{#4}{r}}{}% +\booltrue{LWR@doingcmidrule}% } % \end{macrocode} % \end{macro} @@ -15506,15 +15867,105 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % \begin{macro}{\LWR@docmidrule} \oarg{width} \marg{trim} \marg{leftcolumn-rightcolumn} % % Marks |LWR@midrules| array elements to be ``Y'' from left to right columns. +% Also marks trimming for the L and/or R columns. % % \begin{macrocode} -\NewDocumentCommand{\LWR@docmidrule}{o d() >{\SplitArgument{1}{-}}m}% +\NewDocumentCommand{\LWR@docmidrule}{O{\LWR@cmidrulewidth} D(){} >{\SplitArgument{1}{-}}m}% {\LWR@subcmidrule{#1}{#2}#3} % \end{macrocode} % \end{macro} +% Used to compute margins, tabular trims +% \begin{macrocode} +\newlength{\LWR@templengthone}% +\newlength{\LWR@templengthtwo}% +% \end{macrocode} + + +% \begin{macro}{\LWR@subaddcmidruletrim} \marg{lefttrim} \marg{righttrim} +% Adds a \cs{cmidrule} with optional trim. +% +% \changes{v0.41}{2017/10/05}{Added.} +% +% \begin{macrocode} +\newcommand*{\LWR@subaddcmidruletrim}[2]{% +\setlength{\LWR@templengthone}{\LWR@getexparray{LWR@midrules}{\theLWR@tablecolspos}}% +\ifdimcomp{\LWR@templengthone}{>}{0pt}% +{% +% \end{macrocode} +% Print the class without left and right trim letters appended: +% \begin{macrocode} + \LWR@origtilde tdrule#1#2% +% \end{macrocode} +% Remember the width of the rule: +% \begin{macrocode} + \setlength{\LWR@thiscmidrulewidth}{\LWR@templengthone}% +}{}% +} +% \end{macrocode} +% \end{macro} + + +% \begin{macro}{\LWR@addcmidruletrim} +% Adds left or right trim to a \cs{cmidrule}. +% +% \changes{v0.41}{2017/09/28}{Add: \cs{cmidrule} trims.} +% +% \begin{macrocode} +\newcommand*{\LWR@addcmidruletrim}{% +\LWR@subaddcmidruletrim% +{\LWR@getexparray{LWR@trimlrules}{\theLWR@tablecolspos}}% +{\LWR@getexparray{LWR@trimrrules}{\theLWR@tablecolspos}}% +} +% \end{macrocode} +% \end{macro} + + +% \begin{macro}{\LWR@addrulewidth} \marg{thiswidth} \marg{defaultwidth} +% +% If not default width, add a custom style with width and color +% depending on |thiswidth|. +% \begin{macrocode} +\newcommand{\LWR@addrulewidth}[2]{% +% \end{macrocode} +% Only add a custom width if |thiswidth| is different than the |defaultwidth|: +% \begin{macrocode} +\ifdimcomp{#1}{=}{#2}% +{}% default width +{% custom width +% \end{macrocode} +% Ensure that the width is wide enough to display in the browser: +% \begin{macrocode} + \LWR@forceminwidth{#1}% + \uselengthunit{PT} % explicit space + style="border-top:\rndprintlength{\LWR@atleastonept} solid % +% \end{macrocode} +% The darkness of the color depends on the thickness of the rule: +% \begin{macrocode} + \ifdimcomp{#1}{<}{\LWR@lightrulewidth}% + {\#A0A0A0}% + {% lightrule or heaver + \ifdimcomp{#1}{<}{\LWR@heavyrulewidth}% + {\#808080}% + {black}% + }% lightrule or heavier + "% +}% custom width +} +% \end{macrocode} +% \end{macro} + + +% \begin{macro}{\LWR@addcmidrulewidth} +% \begin{macrocode} +\newcommand{\LWR@addcmidrulewidth}{% +\LWR@addrulewidth{\LWR@thiscmidrulewidth}{\LWR@cmidrulewidth}% +} +% \end{macrocode} +% \end{macro} + % \subsection{Multicolumns} @@ -15706,6 +16157,7 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % \oarg{1: vpos} \oarg{2: \#rows} \marg{3: numcols} \marg{4: colspec} \marg{5: text} % % \changes{v0.39}{2017/08/30}{Add: Optional \protect\texttt{vpos} and \# rows.} +% \changes{v0.41}{2017/09/28}{Add: \cs{cmidrule} trims.} % % \begin{macrocode} \NewDocumentCommand{\LWR@domulticolumn}{o o m m +m}{% @@ -15722,6 +16174,7 @@ link rel="stylesheet" type="text/css" href="\LWR@currentcss" /}% % Row processing: % \begin{macrocode} \LWR@maybenewtablerow% +\LWR@tabularleftedge% % \end{macrocode} % Begin the opening table data tag: % \begin{macrocode} @@ -15751,12 +16204,17 @@ rowspan="#2" % % If this column has a cmidrule, add ``rule'' to the end of the \HTML\ class tag. % % If this position had a ``Y'' then add ``rule''. +% Also add vertical bar class. +% \changes{v0.41}{2017/10/07}{Added vertical rules.} % \begin{macrocode} -\ifthenelse{\equal{\LWR@getexparray{LWR@midrules}{\theLWR@tablecolspos}}{Y}}{rule}{}% +\LWR@addcmidruletrim% +\LWR@addleftmostbartag% +\LWR@printbartag{\theLWR@tablecolspos}% % \end{macrocode} % Close the class tag's opening quote: % \begin{macrocode} "% +\LWR@addcmidrulewidth% }% end of the opening table data tag \global\boolfalse{LWR@intabularmetadata}% \LWR@parsemulticolumnalignment{#4}{\LWR@printmccoldata}% @@ -15972,30 +16430,27 @@ rowspan="#2" % % \end{macrocode} % Temporarily define a macro equal to the |@| specification for this column: % \begin{macrocode} -\edef\LWR@atbangspec{\LWR@getexparray{LWR@colatspec}{\theLWR@tabhtmlcolindex}}% + \edef\LWR@atbangspec{\LWR@getexparray{LWR@colatspec}% + {\theLWR@tabhtmlcolindex}}% % \end{macrocode} % If the |@| specification is not empty, add to the count: % \begin{macrocode} -\ifdefempty{\LWR@atbangspec}{}{\addtocounter{LWR@tabhtmlcoltotal}{1}}% + \ifdefempty{\LWR@atbangspec}% + {}% + {\addtocounter{LWR@tabhtmlcoltotal}{1}}% % \end{macrocode} % Likewise for the |!| columns: % \begin{macrocode} -\edef\LWR@atbangspec{\LWR@getexparray{LWR@colbangspec}{\theLWR@tabhtmlcolindex}}% -\ifdefempty{\LWR@atbangspec}{}{\addtocounter{LWR@tabhtmlcoltotal}{1}}% + \edef\LWR@atbangspec{\LWR@getexparray{LWR@colbangspec}% + {\theLWR@tabhtmlcolindex}}% + \ifdefempty{\LWR@atbangspec}% + {}% + {\addtocounter{LWR@tabhtmlcoltotal}{1}}% % \end{macrocode} % Move to the next \LaTeX\ column: % \begin{macrocode} -\addtocounter{LWR@tabhtmlcolindex}{1}% -}% -% \end{macrocode} -% If at the left-most column, also skip the leftmost |@| and |!| cells: -% \begin{macrocode} -\ifthenelse{\value{LWR@tablecolspos}=1}{% - \edef\LWR@atbangspec{\LWR@getexparray{LWR@colatspec}{leftedge}}% - \ifdefempty{\LWR@atbangspec}{}{\addtocounter{LWR@tabhtmlcoltotal}{1}}% - \edef\LWR@atbangspec{\LWR@getexparray{LWR@colbangspec}{leftedge}}% - \ifdefempty{\LWR@atbangspec}{}{\addtocounter{LWR@tabhtmlcoltotal}{1}}% -}{}% + \addtocounter{LWR@tabhtmlcolindex}{1}% +}% whiledo } % \end{macrocode} % \end{macro} @@ -16104,8 +16559,6 @@ rowspan="#2" % % % \begin{macrocode} \newcommand*{\LWR@donothing}{} -\newcommand*{\LWR@domidrule}{\booltrue{LWR@doinghline}} -\newcommand*{\LWR@dotbrule}{\booltrue{LWR@doingtbrule}} % \end{macrocode} % % In case \pkg{bigdelim} is not loaded: @@ -16160,6 +16613,7 @@ rowspan="#2" % % \begin{macrocode} \newcommand*{\ResumeTabular}{% \global\boolfalse{LWR@exitingtabular}% +\global\boolfalse{LWR@tabularmutemods}% \LWR@getmynexttoken% } % \end{macrocode} @@ -16194,6 +16648,24 @@ rowspan="#2" % \begin{warpHTML} % \end{macrocode} + +% \DescribeBoolean{LWR@exitingtabular} +% When \cs{end} is found, turns off the next opening data tag. +% \begin{macrocode} +\newbool{LWR@exitingtabular} +% \end{macrocode} + + +% \DescribeBoolean{LWR@tabularmutemods} +% Mutes \HTML\ output for |@|, |!|, |<| and |>|. +% +% This is used while printing the final row to generate \cs{bottomrule}s. +% \begin{macrocode} +\newbool{LWR@tabularmutemods} +% \end{macrocode} + + + % \begin{macro}{\LWR@tabledatacolumntag} % Open a new \HTML\ table cell unless the next token is for a macro % which does not create data, such as |\hline|, |\toprule|, etc: @@ -16203,8 +16675,6 @@ rowspan="#2" % % \changes{v0.40}{2017/09/09}{Fix for \pkg{bigdelim}: \cs{ldelim}, \cs{rdelim}.} % % \begin{macrocode} -\newbool{LWR@exitingtabular} - \newcommand*{\LWR@tabledatacolumntag}% {% \LWR@traceinfo{LWR@tabledatacolumntag}% @@ -16235,10 +16705,15 @@ rowspan="#2" % \ifdefequal{\LWR@mynexttoken}{\multicolumnrow}% {\let\mynext\LWR@donothing}{}% % \end{macrocode} -% if come to an |\mrowcell|, this is a cell to be skipped over +% If an |\mrowcell|, this is a cell to be skipped over: % \begin{macrocode} \ifdefequal{\LWR@mynexttoken}{\mrowcell}% {\let\mynext\LWR@donothing}{}% +% \end{macrocode} +% If an |\mcolrowcell|, this is a cell to be skipped over: +% \begin{macrocode} +\ifdefequal{\LWR@mynexttoken}{\mcolrowcell}% + {\let\mynext\LWR@donothing}{}% % \ifdefequal{\LWR@mynexttoken}{\TabularMacro}% {\let\mynext\LWR@donothing}{}% @@ -16295,21 +16770,51 @@ rowspan="#2" % % \subsection{\textbackslash{}mrowcell} +% \codeall +% \begin{macrocode} +\begin{warpall} +% \end{macrocode} + % \begin{macro}{\mrowcell} -% The user must insert |\mrowcell| into any multirow cells which must be skipped. +% The user must insert |\mrowcell| into any \cs{multirow} cells which must be skipped. % This command has no action during print output. % \watchout +% \begin{macrocode} +\newcommand*{\mrowcell}{} +% \end{macrocode} + +% \begin{macrocode} +\end{warpall} +% \end{macrocode} +% \end{macro} + + +% \subsection{\textbackslash{}mcolrowcell} % \codeall % \begin{macrocode} \begin{warpall} -\newcommand*{\mrowcell}{} +% \end{macrocode} + +% \begin{macro}{\mcolrowcell} +% The user must insert |\mcolrowcell| into any \cs{multicolumnrow} cells +% which must be skipped. +% This command has no action during print output. +% \watchout +% \changes{v0.41}{2017/10/05}{Added for \cs{multicolumrow} cells.} +% \begin{macrocode} +\newcommand*{\mcolrowcell}{} +% \end{macrocode} + +% \begin{macrocode} \end{warpall} % \end{macrocode} % \end{macro} + + % \subsection{New \textbackslash{}tabular definition} % \codehtml @@ -16342,13 +16847,42 @@ rowspan="#2" % % \begin{macrocode} \AtBeginDocument{ \@ifpackageloaded{lwarp-tabls} -{\newcommand*{\LWR@hline}[1][]{\LWR@domidrule\LWR@getmynexttoken}} -{\newcommand*{\LWR@hline}{\LWR@domidrule\LWR@getmynexttoken}} +{\newcommand*{\LWR@hline}[1][]{% + \booltrue{LWR@doinghline}% + \LWR@getmynexttoken}} +{\newcommand*{\LWR@hline}{% + \booltrue{LWR@doinghline}% + \LWR@getmynexttoken}} }% AtBeginDocument % \end{macrocode} % \end{macro} % % + +% \begin{macro}{\LWR@nullifyNoAutoSpacing} +% For \pkg{babel-french}, turn off auto spacing at the start of the tabular, +% then nullify the autospacing commands inside the tabular, +% since they were not compatible with the tabular column parsing code, +% which uses \pkg{xstring}. +% \changes{v0.41}{2017/10/06}{Fix: \cs{NoAutoSpacing} in a tabular +% with \protect\pkg{babel-french}.} +% \begin{macrocode} +\AtBeginDocument{ +\@ifundefined{frenchbsetup}% +{% no babel-french + \newcommand*{\LWR@nullifyNoAutoSpacing}{} +}% no babel-french +{% yes babel-french + \newcommand*{\LWR@nullifyNoAutoSpacing}{% + \NoAutoSpacing% + \renewcommand*{\NoAutoSpacing}{}% + \renewcommand*{\LWR@FBcancel}{}% + } +}% yes babel-french +}% AtBeginDocument +% \end{macrocode} +% \end{macro} + % % \begin{environment}{LWR@tabular} \oarg{vertposition} \marg{colspecs} % @@ -16370,21 +16904,27 @@ rowspan="#2" % % \begin{macrocode} \global\boolfalse{LWR@startedrow}% % \end{macrocode} -% Not yet doing an hline: +% Not yet doing any rules: % \begin{macrocode} \global\boolfalse{LWR@doinghline}% -% \end{macrocode} -% Not yet doing a top/bottom rule: -% \begin{macrocode} \global\boolfalse{LWR@doingtbrule}% +\global\boolfalse{LWR@doingcmidrule}% % \end{macrocode} -% For \pkg{babel-french}: +% +% For \pkg{babel-french}, turn off auto spacing one time, then nullify +% the autospacing commands since were not compatible with the tabular parsing code. +% +% \changes{v0.41}{2017/10/06}{Fix: \cs{NoAutoSpacing} in a tabular +% with \protect\pkg{babel-french}.} +% % \begin{macrocode} -\LWR@FBcancel% +\LWR@nullifyNoAutoSpacing% % \end{macrocode} -% Have not yet found the end of tabular command: +% Have not yet found the end of tabular command. +% Unmute the |@| and |!| columns. % \begin{macrocode} \boolfalse{LWR@exitingtabular}% +\boolfalse{LWR@tabularmutemods}% % \end{macrocode} % Create the |table| tag: % \begin{macrocode} @@ -16425,32 +16965,62 @@ rowspan="#2" % % \RenewDocumentCommand{\cline}{m}% {\LWR@docmidrule{##1}\LWR@getmynexttoken}% - -\DeclareDocumentCommand{\toprule}{o}{\LWR@dotbrule\LWR@getmynexttoken}% - -\DeclareDocumentCommand{\midrule}{o}{\LWR@domidrule\LWR@getmynexttoken}% - -\DeclareDocumentCommand{\cmidrule}{o d() m}% +% \end{macrocode} +% \changes{v0.41}{2017/10/03}{Improved rules.} +% \begin{macrocode} +\DeclareDocumentCommand{\toprule}{o d()} + {% + \IfValueTF{##1}% + {\LWR@docmidrule[##1](){1-\theLWR@tabletotalcols}}% + {\booltrue{LWR@doingtbrule}}% + \LWR@getmynexttoken}% +% +\DeclareDocumentCommand{\midrule}{o d()}% + {% + \IfValueTF{##1}% + {\LWR@docmidrule[##1](){1-\theLWR@tabletotalcols}}% + {\booltrue{LWR@doinghline}}% + \LWR@getmynexttoken}% +% +\DeclareDocumentCommand{\cmidrule}{O{\LWR@cmidrulewidth} d() m}% {\LWR@docmidrule[##1](##2){##3}\LWR@getmynexttoken}% - -\DeclareDocumentCommand{\bottomrule}{o}{\LWR@dotbrule\LWR@getmynexttoken}% -\DeclareDocumentCommand{\addlinespace}{o}{} -\DeclareDocumentCommand{\morecmidrules}{}{} -\DeclareDocumentCommand{\specialrule}{m m m}{\LWR@domidrule\LWR@getmynexttoken} +% +\DeclareDocumentCommand{\bottomrule}{o d()} + {% + \IfValueTF{##1}% + {\LWR@docmidrule[##1](){1-\theLWR@tabletotalcols}}% + {\booltrue{LWR@doingtbrule}}% + \LWR@getmynexttoken}% +% +\DeclareDocumentCommand{\addlinespace}{o}{}% +\DeclareDocumentCommand{\morecmidrules}{}{}% +\DeclareDocumentCommand{\specialrule}{m m m d()}% + {\LWR@docmidrule[##1](){1-\theLWR@tabletotalcols}\LWR@getmynexttoken}% % \end{macrocode} % The following create data cells and will have no more data in this cell, % so we do not want to look ahead for a possible data cell, % so do not want to use |\LWR@getmynexttoken|. % \begin{macrocode} \renewcommand{\multicolumn}{\LWR@htmlmulticolumn}% -\renewcommand*{\mrowcell}{\global\booltrue{LWR@skippingmrowcell}}% +\renewcommand*{\mrowcell}{% + \LWR@maybenewtablerow% + \LWR@tabularleftedge% + \global\booltrue{LWR@skippingmrowcell}% +}% +\renewcommand*{\mcolrowcell}{% + \LWR@maybenewtablerow% + \LWR@tabularleftedge% + \global\booltrue{LWR@skippingmcolrowcell}% +}% \LetLtxMacro{\caption}{\LWR@longtabledatacaptiontag}% % \end{macrocode} % Reset for new processing: % \begin{macrocode} \global\boolfalse{LWR@tableparcell}% \global\boolfalse{LWR@skippingmrowcell}% +\global\boolfalse{LWR@skippingmcolrowcell}% \global\boolfalse{LWR@skipatbang}% +\global\boolfalse{LWR@emptyatbang}% % \end{macrocode} % Set |&| for its special meaning inside the tabular: % \begin{macrocode} @@ -16467,7 +17037,12 @@ rowspan="#2" % % \begin{macrocode} {% \LWR@traceinfo{LWR@tabular ending}% -\LWR@closetabledatacell% +\ifthenelse{\value{LWR@tablecolspos}<\value{LWR@tablecolswidth}}{% + \LWR@tabularfinishrow% +}% +{% + \LWR@closetabledatacell% +}% \LWR@htmlblocktag{/tr}% \LWR@htmlblocktag{/table}% \global\boolfalse{LWR@intabularmetadata}% @@ -16496,6 +17071,7 @@ rowspan="#2" % + % \subsection{Array} % \label{sec:array} @@ -20192,7 +20768,7 @@ class="#3"\LWR@orignewline}#2\LWR@htmltag{/a}% % % \begin{macro}{\LWR@forceminwidth} \marg{legth} % -% Sets \cs{LWR@tempwidth} to be at least 1pt. +% Sets \cs{LWR@atleastonept} to be at least 1pt. % \begin{macrocode} \newlength{\LWR@atleastonept} @@ -21659,11 +22235,8 @@ width:\rndprintlength{\LWR@tempwidth}% % \begin{macrocode} \RequirePackage{multicol} % \end{macrocode} -% Used to compute margins: -% \begin{macrocode} -\newlength{\LWR@templengthone}% -\newlength{\LWR@templengthtwo}% -% \end{macrocode} + + % * \marg{numcols} \marg{left margi} \marg{right margin} % \marginpar{\hfill\env{adjmulticols}} % \begin{macrocode} @@ -28155,18 +28728,20 @@ background: % % \subsection{Multirow} % -% \begin{macro}{\LWR@tabledatamultirowtag} +% \DescribeMacro{\multirow} % \oarg{vpos} \marg{numrows} \oarg{bigstruts} \marg{width} \oarg{fixup} \marg{text} % \changes{v0.19}{2015/05/28}{Added optional args.} % \changes{v0.39}{2017/08/30}{Add: New optional \protect\texttt{vpos} argument.} % \changes{v0.39}{2017/08/30}{Add: Supports left/right border for \pkg{bigdelim}.} % \changes{v0.39}{2017/08/30}{Fix: Long text argument.} % \changes{v0.40}{2017/09/22}{Improved \pkg{bigdelim} borders.} +% \changes{v0.41}{2017/09/28}{Add: \cs{cmidrule} trims.} % \begin{macrocode} \RenewDocumentCommand{\multirow}{O{c} m o m o +m}% {% \LWR@traceinfo{*** multirow #1 #2 #4} \LWR@maybenewtablerow% +\LWR@tabularleftedge% % \end{macrocode} % Print the start of a new table data cell: % \begin{macrocode} @@ -28184,7 +28759,7 @@ background: \ifdefvoid{\LWR@multirowborder}{}{% style="border-\LWR@multirowborder: 2px dotted black ; % padding-\LWR@multirowborder: 2px" % -} +}% % \end{macrocode} % A class adds the column spec and the rule: % \begin{macrocode} @@ -28194,21 +28769,31 @@ class="td% % \begin{macrocode} \StrChar{\LWR@tablecolspec}{\theLWR@tablecolspos}% % \end{macrocode} -% If this column has a cmidrule, add ``rule'' to the end of the \HTML\ class tag: +% If this column has a cmidrule, add ``rule'' to the end of the \HTML\ class tag. +% Also add the vertical bar class. +% \changes{v0.41}{2017/10/07}{Added vertical rules.} % \begin{macrocode} -\ifthenelse{\equal{\LWR@getexparray{LWR@midrules}{\theLWR@tablecolspos}}{Y}}{rule}{}% -"{}} +\LWR@addcmidruletrim% +\LWR@addleftmostbartag% +\LWR@printbartag{\theLWR@tablecolspos}% +"% +\LWR@addcmidrulewidth% +}% +% \end{macrocode} +% \changes{v0.41}{2017/10/05}{Fix: \protect\textless\ spec.} +% The column's |<| spec: +% \begin{macrocode} +\LWR@getexparray{LWR@colbeforespec}{\theLWR@tablecolspos}% % \end{macrocode} % While printing the text, redefine |\\| to generate a new line % \begin{macrocode} -\begingroup \LetLtxMacro{\\}{\LWR@endofline} #6 \endgroup +\begingroup\LetLtxMacro{\\}{\LWR@endofline}#6\endgroup% \LWR@stoppars% \global\boolfalse{LWR@intabularmetadata}% \renewcommand{\LWR@multirowborder}{}% \LWR@traceinfo{*** multirow done}% }% % \end{macrocode} -% \end{macro} % % % \subsection{Combined multicolumn and multirow} |