0

I need to add some dividing rows to a longtable to set apart different sections. The Word template I'm working off of has dividing lines like so:

Example rows

My current attempt to replicate this uses three hlines and changes \arrayrulewidth and \arrayrulecolor for the middle one. Some example code:

\documentclass[letterpaper,10pt]{article} 
\usepackage[margin=.5in]{geometry}
\usepackage[table]{xcolor}
\usepackage{longtable}
\usepackage{array}
\usepackage{multicol}
\begin{document}
\arrayrulecolor{red}
\begin{longtable}{|m{1.5in}|m{2.5in}|m{2.5in}|}
\hline
Section 1 & Scales 1 & Subscales 1 \\
\hline
\noalign{\global\arrayrulewidth=4pt}\arrayrulecolor{blue}
\hline
\noalign{\global\arrayrulewidth=.4pt}\arrayrulecolor{red}
\hline
Section 2 & Scales 2 & Subscales 2 \\
\hline
\end{longtable}
\end{document}

However, this causes a break in the outer border and looks a little awkward: Current code example

Is there some workaround to get the border to show, or is there an alternate way of achieving this?

1

This is easy to do with \hhline:

\documentclass[letterpaper,10pt]{article}
\usepackage[margin=.5in]{geometry}
\usepackage[table]{xcolor}
\usepackage{longtable}
\usepackage{array, hhline}
\usepackage{multicol}

\begin{document}

\arrayrulecolor{red}
\setlength{\doublerulesep }{4pt}
\doublerulesepcolor{blue}
\begin{longtable}{|m{1.5in}|m{2.5in}|m{2.5in}|}
\hhline{|-|-|-|}
Section 1 & Scales 1 & Subscales 1 \\
\hhline{|=|=|=|}
Section 2 & Scales 2 & Subscales 2 \\
\hhline{|-|-|-|}
\end{longtable}
\arrayrulecolor{black}
\doublerulesepcolor{white}

\end{document} 

enter image description here enter image description here

| improve this answer | |
  • The group around thelongtable suggests that it will limit the scope of the \arrayrulecolor and \doublerulesepcolor but it won't (these affectations are global). It would be clearer for the reader to put these instructions outside the group. – F. Pantigny Aug 22 '19 at 15:20
  • That's right. Thanks for pointing the problem. I'll fix the code instantly. – Bernard Aug 22 '19 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.