2
\documentclass{article}

\newenvironment{mytabbing}{%
\begin{minipage}[t]{3in}
\begin{tabbing}
\hspace*{2cm}\= \hspace*{2cm}\= \hspace*{2cm}\= \hspace*{2cm} \kill
TAB-1 \> TAB-2 \> TAB-3 \> TAB-4\\
}%
{\end{tabbing}\end{minipage}}%

\begin{document}
\begin{mytabbing}
Test1 \> Test2 \> Test3 \>Test4
\end{mytabbing}

\end{document}

If I want colored background for the column names (TAB-1 ...), do I have to work in some tabular (tabularx, etc.) environment, and I have no other option? Something like:

enter image description here

blackened
  • 4,181

3 Answers3

1

Here is a solution with {NiceTabular} of nicematrix. You won't see any thin white line in the gray panel of the first row, whatever PDF you use and whatever level of zoom you use.

\documentclass{article}
\usepackage[margin=1in]{geometry}

\usepackage{amssymb} \usepackage{xcolor} \newcommand{\cred}[1]{\color{red}#1} \newcommand{\wt}[1]{\color{white}\textbf{#1}} \usepackage{nicematrix}

\begin{document}

\begin{center} \begin{NiceTabular}{llll}[cell-space-top-limit=3pt] \RowStyle[bold,rowcolor=gray,color=white]{} SOUTH & WEST & NORTH & EAST \


    & 1 $\clubsuit$   
            & Double    & Pass  \\

1 $\cred{\blacklozenge}$ & Pass & 2 $\clubsuit$ & Pass \ 2 $\cred{\blacklozenge}$ & Pass & 2 $\cred{\spadesuit}$ & Pass \ \quad \textbf{?} & & & \ \end{NiceTabular} \end{center}

\end{document}

You need several compilations (because nicematrix uses PGF/Tikz nodes under the hood).

Output of the above code

F. Pantigny
  • 40,250
0

Here is the solution with the tabular environment.

\documentclass{article}

\usepackage[margin=1in]{geometry} \usepackage{colortbl} \usepackage{xcolor} \usepackage{amssymb} \usepackage{tikz}

\renewcommand{\arraystretch}{2} \newcommand{\cred}[1]{\color{red}#1} \newcommand{\wt}[1]{\color{white}\textbf{#1}}

\begin{document}

\begin{center}
    \begin{tabular}{llll}
        \rowcolor{gray!60} \wt{SOUTH} & \wt{WEST} & \wt{NORTH} & \wt{EAST} \\
        \tikz \draw (0,0) -- (1,0); & 1 $\clubsuit$   & Double & Pass\\
        1 $\cred{\blacklozenge}$ & Pass & 2 $\clubsuit$ & Pass \\
        2 $\cred{\blacklozenge}$ & Pass & 2 $\cred{\spadesuit}$& Pass \\
        \hspace{0.15cm}\textbf{?}  & & & \\
    \end{tabular}
\end{center}

\end{document}

The ? is now centered.

code output is shown as

0

Solution with use of the tabularray table package:

\documentclass{article}
\usepackage[margin=1in]{geometry}

\usepackage{amssymb} \usepackage{xcolor} \newcommand{\cred}[1]{\color{red}#1} \newcommand{\wt}[1]{\color{white}\textbf{#1}} \usepackage{tabularray}

\begin{document}

\begin{center} \begin{tblr}{row{1}={font=\bfseries, bg=gray, fg=white, abovesep+=2pt}, colspec=llll, } SOUTH & WEST & NORTH & EAST \


    & 1 $\clubsuit$   
            & Double    & Pass  \\

1 $\cred{\blacklozenge}$ & Pass & 2 $\clubsuit$ & Pass \ 2 $\cred{\blacklozenge}$ & Pass & 2 $\cred{\spadesuit}$ & Pass \ \SetCell[c=1]{l,font=\bfseries} ;? & & & \ \end{tblr} \end{center}

\end{document}

enter image description here

Zarko
  • 296,517