I am trying to make place some bold & colored borders around certain cells in a longtable using hhline and multicolumn. I noticed that \setlength\arrayrulewidth has different behavior though if the line is - or = and I was hoping someone could explain why.
Full code:
\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{caption}[singlelinecheck=off]
\usepackage{longtable}
\setlength{\LTleft}{0pt plus 1fill minus 1fill}
\setlength{\LTright}{\LTleft}
\usepackage{xcolor}
\usepackage{amssymb}
\usepackage{color}
\usepackage{colortbl, hhline}
\usepackage{array}
\usepackage{threeparttablex}
\def\settotextwidth{\renewcommand\TPTminimum{\textwidth}}
\begin{document}
\definecolor{purple}{rgb}{0.694117647058824,0.611764705882353,0.850980392156863}
\newcommand{\boldcolored}{\arrayrulecolor{purple}\setlength\arrayrulewidth{5pt}}
\newcommand{\regcolored}{\arrayrulecolor{purple}}
\newcommand{\resetcolor}{\arrayrulecolor{black}}
\newcommand{\vboldcolored}{{\color{purple}\vline width 5pt}}
\begin{ThreePartTable}
\settotextwidth
\begin{TableNotes}
\setlength\labelsep{0pt}
\footnotesize
\arraybackslash\raggedright
\item
\arraybackslash\raggedright
\item Script code:
\item Tex code:
\end{TableNotes}
\begin{center}
\setlength\labelsep{0pt}
{\large Fruit Table } \\
\vspace{3mm}
{\small testing } \\
\vspace{-3mm}
\end{center}
\setlength{\tabcolsep}{3pt}
\captionsetup[table]{labelformat=empty,skip=3pt, justification=raggedright, width =\textwidth}
\begin{longtable}{p{1.72cm}p{1.72cm}p{1.72cm}p{1.72cm}}
\toprule
& & \multicolumn{2}{c}{Summary} \\
\cmidrule(lr){3-4}
Category & Fruit & Total & Color\\
\endfirsthead
\endhead
\bottomrule
\addlinespace
\insertTableNotes
\endlastfoot
\midrule
\multicolumn{4}{l}{Least Favorite} \\
\midrule
\multicolumn{1}{!\vboldcolored l !\vboldcolored}{fruit 3}& grape & \multicolumn{1}{!\vboldcolored l !\vboldcolored}{3} & purple \\
\hhline{>{\boldcolored}=>{\regcolored}=>{\boldcolored}->{\regcolored}-}\resetcolor
fruit 4 & pear & 4 & green \\
fruit 5 & orange & 5 & orange \\
\midrule
Total & — & 12 & — \\
AVG & — & 4 & — \\
\midrule
\multicolumn{4}{l}{\vspace*{-5mm}} \\
\midrule
fruit 1 & apple & 1 & red \\
fruit 2 & banana & 2 & yellow \\
\midrule
Sum ALL & — & 15 & — \\
\bottomrule
\end{longtable}
\end{ThreePartTable}
\end{document}
Using pdflatex my table outputs as:
I don't understand why the \boldcolored command only seems to work on the = line here, but not the - one?
To check if it was an issue with changing the rule width midline, I switched the - to the first position and tried to bold it there, but it did not work. I also moved the thick = line to midline and I was able to change rule width. Output:
code for the second table:
\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{caption}[singlelinecheck=off]
\usepackage{longtable}
\setlength{\LTleft}{0pt plus 1fill minus 1fill}
\setlength{\LTright}{\LTleft}
\usepackage{xcolor}
\usepackage{amssymb}
\usepackage{color}
\usepackage{colortbl, hhline}
\usepackage{array}
\usepackage{threeparttablex}
\def\settotextwidth{\renewcommand\TPTminimum{\textwidth}}
\begin{document}
\definecolor{purple}{rgb}{0.694117647058824,0.611764705882353,0.850980392156863}
\newcommand{\boldcolored}{\arrayrulecolor{purple}\setlength\arrayrulewidth{5pt}}
\newcommand{\regcolored}{\arrayrulecolor{purple}}
\newcommand{\resetcolor}{\arrayrulecolor{black}}
\newcommand{\vboldcolored}{{\color{purple}\vline width 5pt}}
\begin{ThreePartTable}
\settotextwidth
\begin{TableNotes}
\setlength\labelsep{0pt}
\footnotesize
\arraybackslash\raggedright
\item
\arraybackslash\raggedright
\item Script code:
\item Tex code:
\end{TableNotes}
\begin{center}
\setlength\labelsep{0pt}
{\large Fruit Table } \\
\vspace{3mm}
{\small testing } \\
\vspace{-3mm}
\end{center}
\setlength{\tabcolsep}{3pt}
\captionsetup[table]{labelformat=empty,skip=3pt, justification=raggedright, width =\textwidth}
\begin{longtable}{p{1.72cm}p{1.72cm}p{1.72cm}p{1.72cm}}
\toprule
& & \multicolumn{2}{c}{Summary} \\
\cmidrule(lr){3-4}
Category & Fruit & Total & Color\\
\endfirsthead
\endhead
\bottomrule
\addlinespace
\insertTableNotes
\endlastfoot
\midrule
\multicolumn{4}{l}{Least Favorite} \\
\midrule
\multicolumn{1}{!\vboldcolored l !\vboldcolored}{fruit 3}& grape & \multicolumn{1}{!\vboldcolored l !\vboldcolored}{3} & purple \\
\hhline{>{\boldcolored}->{\regcolored}=>{\boldcolored}=>{\regcolored}-}\resetcolor
fruit 4 & pear & 4 & green \\
fruit 5 & orange & 5 & orange \\
\midrule
Total & — & 12 & — \\
AVG & — & 4 & — \\
\midrule
\multicolumn{4}{l}{\vspace*{-5mm}} \\
\midrule
fruit 1 & apple & 1 & red \\
fruit 2 & banana & 2 & yellow \\
\midrule
Sum ALL & — & 15 & — \\
\bottomrule
\end{longtable}
\end{ThreePartTable}
\end{document}



=line to midline position and the bold-to first position and I expected the single line to work and the double line to not work if this were to be the case.. but it was the opposite. Now I am wondering what's the difference between-and=? – Anna Nevison Jun 09 '20 at 22:18hhlineseemed to have everything I needed so I was just playing around with it and thought this was interesting. But I will definitely try that recommendation- thank you again! – Anna Nevison Jun 09 '20 at 22:57