2

is there any way to make the following two horizontal lines on the background of a cell? Cell should contain either a blue or green horizontal line in the middle. Or the third option is both.

Here below is a simplified tabular that I would like it applied, but somehow I do not know how to ..

\documentclass[landscape,11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[czech, english]{babel}
%How to make background in tabular cell (vertical lines)?

%USEPACKAGE
\usepackage{tikz}
\usepackage{tcolorbox}
\usepackage{color}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{hhline}

%--------------------
\usepackage{geometry}
\geometry{
    a4paper,
    total={210mm,297mm},
    left=10mm,
    right=10mm,
    top=6mm,
    bottom=2mm,
    bindingoffset=0mm
}

\begin{document}
\pagestyle{empty}
\thispagestyle{empty}
\shorthandoff{-}

\begin{tabular}{|c|c|c|c|}
\hline
\multicolumn{4}{|c|}{Tabular XY} \\
\hline\hline

\multirow{2}{*}{1} & \parbox[c][1cm][c]{2cm}{\centering \scriptsize Lorem ipsum dolor sit amet} & \parbox[c][1cm][c]{1cm}{\centering \scriptsize Lorem ipsum} & Y \\

\hhline{*{1}{|~}*{2}{|-}|-|}

& \parbox[c][1cm][c]{2cm}{\centering \scriptsize Lorem ipsum dolor sit amet} & \parbox[c][1cm][c]{1cm}{\centering \scriptsize Lorem ipsum} & X \\

\hline
\end{tabular}

\end{document}

enter image description here

4

enter image description here

\documentclass[landscape,11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[czech, english]{babel}
%How to make background in tabular cell (vertical lines)?

%USEPACKAGE
\usepackage{tikz}
\usepackage{tcolorbox}
\usepackage{color}
\usepackage{multicol}
\usepackage{multirow}
\usepackage{hhline}

%--------------------
\usepackage{geometry}
\geometry{
    a4paper,
    total={210mm,297mm},
    left=10mm,
    right=10mm,
    top=6mm,
    bottom=2mm,
    bindingoffset=0mm
}

\usepackage{colortbl}
\begin{document}
\pagestyle{empty}
\thispagestyle{empty}
\shorthandoff{-}

\newcommand\R[1]{\mbox{}\hspace{\dimexpr#1-2.5pt}\textcolor{red}{\vrule width 5pt}\hspace{\dimexpr-#1-2.5pt}\mbox{}}
\newcommand\G[1]{\mbox{}\hspace{\dimexpr#1-2.5pt}\textcolor{green}{\vrule width 5pt}\hspace{\dimexpr-#1-2.5pt}\mbox{}}
\newcommand\RG[1]{\mbox{}\hspace{\dimexpr#1-7.5pt}\textcolor{red}{\vrule width 5pt}%
                                                 \hspace{5pt}%
                                                 \textcolor{green}{\vrule width 5pt}%
                                                 \hspace{\dimexpr-#1-7.5pt}\mbox{}}
\begin{tabular}{|c|c|c|c|}
\hline
\multicolumn{4}{|c|}{Tabular XY} \\
\hline\hline

\multirow{2}{*}{1} &\R{1cm} \parbox[c][1cm][c]{2cm}{\centering \scriptsize Lorem ipsum dolor sit amet} & \G{.5cm}\parbox[c][1cm][c]{1cm}{\centering \scriptsize Lorem ipsum} & Y \\

\hhline{*{1}{|~}*{2}{|-}|-|}

& \RG{1cm}\parbox[c][1cm][c]{2cm}{\centering \scriptsize Lorem ipsum dolor sit amet} & \parbox[c][1cm][c]{1cm}{\centering \scriptsize Lorem ipsum} & X \\

\hline
\end{tabular}

\end{document}

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.