1

during my work I've encountered the following problem: I tried to prepare external border of my table. And it worked fine, to the time I applied \multicolumn command to merge two adjacent cells. The name of new merged cell is "Oznaczenia zastosowane w artykule".

Please look at screenshot below.

enter image description here

We can see that there is blue thin part border color at left and right from the cell "Oznaczenia zastosowane w artykule":

How to improve that and keep that color of external thicker border at both sides (left and right)?

Below is my MWE code:

\documentclass[aps,physrev,showkeys,twocolumn,nofootinbib,floatfix]{revtex4-2}
\usepackage[polish]{babel}
\selectlanguage{polish}
\usepackage{polski}
\usepackage[table,xcdraw]{xcolor}
\usepackage{array,booktabs}
\usepackage{multirow}
\usepackage{tabularx}
\usepackage{setspace}
\newcommand\VRule[1][\arrayrulewidth]{\vrule width #1}


\begin{document}

\onecolumngrid
\newpage
\arrayrulecolor{blue}
\begin{table}[htbp]

\begin{tabular}{ !{\color{red}\VRule[.5mm]} l    l !{\color{green}\VRule[.5mm]}  } \specialrule{.5mm}{2pt}{0cm}
\hfill & \hfill \\[0.25cm]
\multicolumn{2}{|l|} {\hspace{5mm}\textbf{Oznaczenia zastosowane w artykule} }  \\ [4mm]
\hspace{5mm} \textbf{Symbol} & \textbf{Opis} \\ [4.5mm]
\hspace{5mm} $\mathrm{ a }$ \hspace{3cm} & --~połowa długości [długość] pęknięcia w próbce M(T) [CT]  \\ 
\hspace{5mm} $\mathrm{ BFS }$ & --~oznaczenie pozycji czujnika \\
\hspace{5mm} $\mathrm{ CC }$ & --~zamykanie się pęknięcia  \\ \specialrule{2pt}{0pt}{0pt}
\end{tabular}
\end{table}
\twocolumngrid

\end{document}
3
  • 1
    you specified normal rules \multicolumn{2}{|l|} I guess you wanted \multicolumn{2}{!{\color{red}\VRule[.5mm]}l!{\color{red}\VRule[.5mm]}} Jan 17 at 10:51
  • 1
    My impression is that you want to consider tcolorbox for this task.
    – egreg
    Jan 17 at 11:23
  • @DavidCarlisle yes, thank you, that has solved my problem :) Thank you also egreg for suggestion.
    – Rejnold
    Jan 17 at 11:54

2 Answers 2

3

you specified normal rules

 \multicolumn{2}{|l|}

I guess you wanted

\multicolumn{2}{!{\color{red}\VRule[.5mm]}l!{\color{red}\VRule[.5mm]}} 
2

You may be interested write your table by using of the tabularray package. Its way of writing of multi column cells doesn't overwrite in table preamble defined rules, so your problem cannot be happen:

\documentclass[aps,physrev,showkeys,twocolumn,nofootinbib,floatfix]{revtex4-2}
\usepackage[polish]{babel}
\selectlanguage{polish}
\usepackage{polski}
\usepackage[table,xcdraw]{xcolor}
\usepackage{tabularray}


\begin{document}

\onecolumngrid
\newpage
    \begin{table}[htbp]
\begin{tblr}{hline{1,Z} = {0.5mm,blue}, vline{1,Z} = {0.5mm, red},
             colspec  = {Q[l, mode=math, leftsep=4mm, wd=9em] Q[l]},
             row{1,2} = {font=\bfseries, mode=text},
             row{1-3} = {abovesep=4mm}
             }
\SetCell[c=2]{l}    Oznaczenia zastosowane w artykule     % multicolumn cell    
                &                                                           \\ 
Symbol          &   Opis                                                    \\ 
\mathrm{a}      & -- połowa długości [długość] pęknięcia w próbce M(T) [CT] \\
\mathrm{BFS}    & -- oznaczenie pozycji czujnika                            \\
\mathrm{CC}     & -- zamykanie się pęknięcia                                \\ 
\end{tblr}
    \end{table}
\twocolumngrid

\end{document}

enter image description here

In comparison with your MWE, proposed solution ha the following differences:

  • first column has left column separation equal 4mm, so you not need to insert horizontal spaces to their cell
  • first column is in math node (consequently you not need to write $)
  • First three row has above vertical space defined in table preamble, so [5.5mm]˛ after rows terminators are removed
  • first two rows are in text mode with `bfseries font
3
  • Thank you, your solution tends to be much elegant and clear!
    – Rejnold
    Jan 17 at 14:55
  • @Rejnold, you are welcome.
    – Zarko
    Jan 17 at 15:18
  • @Rejnold, you are welcome. See my similar answer on your previous quartion tex.stackexchange.com/questions/671927/…. BTW, now you can upvote answers too ...
    – Zarko
    Jan 17 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.