Guest User

Misplaced \cr MWE

a guest
Jun 9th, 2019
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Latex 1.88 KB | None | 0 0
  1. % \documentclass[sans,math,palette=es]{bmc}
  2. \documentclass{article}
  3.  
  4. \usepackage{etoolbox}
  5. \usepackage{booktabs}
  6. \usepackage[table]{xcolor}
  7.  
  8. \colorlet{text}{black}
  9. \colorlet{page}{white}
  10. \colorlet{tableheadcolor}{orange!30!page}
  11.  
  12. % Use of \showrowcolors and \hiderowcolors is an idea from Ulrike
  13. % Fischer's answer here: <https://tex.stackexchange.com/a/494954/73317>
  14. \renewcommand{\toprule}{%
  15.     \showrowcolors
  16.     \arrayrulecolor{text}\specialrule{\heavyrulewidth}{\abovetopsep}{0pt}%
  17.     \arrayrulecolor{tableheadcolor}\specialrule{\belowrulesep}{0pt}{0pt}%
  18.     \arrayrulecolor{text}%
  19.     \rowcolor{tableheadcolor}%
  20. }
  21.  
  22. \apptocmd\midrule{\hiderowcolors}{}{\FAILED}
  23.  
  24. \makeatletter
  25.  
  26. \let\@BTrule@ORI=\@BTrule
  27. \let\my@BTrule=\@BTrule
  28.  
  29. % Modified version of \@BTrule that doesn't do \vskip\@aboverulesep, for use
  30. % when the corresponding vertical space should be coloured.
  31. \patchcmd{\my@BTrule}{%
  32.     \ifnum\@lastruleclass=\z@\vskip\@aboverulesep\else
  33.   }{%
  34.     \ifnum\@lastruleclass=\z@\else
  35.   }{}{\FAILED}
  36.  
  37. \let\@arraycrORI=\@arraycr
  38.  
  39. \renewcommand*{\@arraycr}{%
  40.   \@ifnextchar\midrule\my@endtablehead\@arraycrORI
  41. }
  42.  
  43. \newcommand*{\my@endtablehead}{%
  44.  \@arraycrORI[\aboverulesep]% this colours the additional space with the
  45.                             % current row color
  46.  \noalign{\global\let\@BTrule\my@BTrule}% temporarily modify \@BTrule
  47.  \midrule
  48.  \noalign{\global\let\@BTrule\@BTrule@ORI}% restore it
  49.  \@gobble % gobble the following \midrule (which *must* be there!)
  50. }
  51.  
  52. \makeatother
  53.  
  54. \rowcolors{1}{tableheadcolor}{tableheadcolor}
  55.  
  56. \title{Test}
  57. \author{Auth}
  58.  
  59. \begin{document}
  60.  
  61. \begin{tabular}{>{\hspace{3pt}\normalsize}l>{\hspace{5pt}}*{5}{p{7.9em}}}
  62.    \toprule
  63.    Category & \multicolumn{5}{l}{\normalsize Packages} \\
  64.    \midrule
  65.    General & etb & xpt & sil & ifd & geom \\
  66.    & tts & ttc & frm & tps & clc \\
  67. \end{tabular}
  68.  
  69. \end{document}
Advertisement
Add Comment
Please, Sign In to add comment