\documentclass[12pt]{article}
\usepackage[
a4paper,
margin = 5mm,
landscape,
%showframe,
]
{geometry}
\usepackage{tabularx}
\usepackage{booktabs}
\usepackage{multirow}
\renewcommand{\aboverulesep}{0pt}
\renewcommand{\belowrulesep}{0pt}
\usepackage[table]{xcolor} % loads also colortbl
\definecolor{myTableColor}{gray}{0.80}
\usepackage[sfdefault]{cabin}
\begin{document}
\noindent
\setlength{\arrayrulewidth}{1pt}
\begin{tabularx}{\textwidth}{lc|l|X|X|X|X}
\toprule
\rowcolor{myTableColor}
\multicolumn{2}{l}{\textbf{Text}} & Text & Text & Text & Text & Text\\
\midrule
Text & \cellcolor{myTableColor} & & & & & \\
%\cmidrule{3-7}
\cline{3-7}
Text & \cellcolor{myTableColor}\multirow{-2}{*}{A} & & & & & \\
\midrule
\multicolumn{2}{l|}{Text} & & & & & \\
\midrule
Text & \cellcolor{myTableColor} & & & & & \\
\cmidrule{3-7}
%\cline{3-7}
Text & \cellcolor{myTableColor}\multirow{-2}{*}{A} & & & & & \\
\bottomrule
\end{tabularx}
% \multirow{-2}{*}{A} is taken from user Gonzalo Medina
% https://tex.stackexchange.com/questions/21155
\end{document}
- eu tenho
multirow
ecellcolor
. - Eu quero usar
\cmidrule
debooktabs
. - Eu recebo uma linha while estranha.
\cline
funciona bem.- Eu também tentei
\cmidrule[0pt]
. - Além disso, a largura da linha
\cmidrule
e\midrule
parece ser diferente.
Responder1
Este código faz mais ou menos o que você deseja com makecell
e a \Xcline{3-7}{0.05em}
: o valor de 0.05em
é a espessura padrão de \midrule
( \lightrulewidth
). Quanto a \cmidrule
, o padrão é 0.03em
.
\documentclass[12pt]{article}
\usepackage[
a4paper,
margin = 5mm,
landscape,
%showframe,
]
{geometry}
\usepackage{tabularx}
\usepackage{booktabs, makecell}
\usepackage{multirow}
\renewcommand{\aboverulesep}{0pt}
\renewcommand{\belowrulesep}{0pt}
\usepackage[table]{xcolor} % loads also colortbl
\definecolor{myTableColor}{gray}{0.80}
\usepackage[sfdefault]{cabin}
\begin{document}
\noindent
\setlength{\arrayrulewidth}{1pt}
\begin{tabularx}{\textwidth}{lc|l|X|X|X|X}
\toprule
\rowcolor{myTableColor}
\multicolumn{2}{l}{\textbf{Text}} & Text & Text & Text & Text & Text\\
\midrule
Text & \cellcolor{myTableColor} & & & & & \\
\Xcline{3-7}{0.05em}
Text & \cellcolor{myTableColor}\multirow{-2}{*}{A} & & & & & \\
\midrule
\multicolumn{2}{l|}{Text} & & & & & \\
\midrule
Text & \cellcolor{myTableColor} & & & & & \\
\Xcline{3-7}{0.05em}
Text & \cellcolor{myTableColor}\multirow{-2}{*}{A} & & & & & \\
\bottomrule
\end{tabularx}
% \multirow{-2}{*}{A} is taken from user Gonzalo Medina
% https://tex.stackexchange.com/questions/21155
\end{document}
Responder2
Com {NiceTabular}
of nicematrix
, você pode usar diretamente \midrule
e \cmidrule
of booktabs
com a saída esperada.
\documentclass[12pt]{article}
\usepackage{xcolor}
\usepackage[a4paper,margin = 5mm,landscape]{geometry}
\usepackage{booktabs}
\renewcommand{\aboverulesep}{0pt}
\renewcommand{\belowrulesep}{0pt}
\usepackage{nicematrix}
\definecolor{myTableColor}{gray}{0.80}
\usepackage[sfdefault]{cabin}
\begin{document}
\noindent
\setlength{\arrayrulewidth}{1pt}
\begin{NiceTabularX}{\textwidth}{lc|l|X|X|X|X}
\toprule
\RowStyle[rowcolor=myTableColor]{}
\Block[l]{1-2}{\textbf{Text}} & Text & Text & Text & Text & Text \\
\midrule
Text & \Block[fill=myTableColor]{2-1}{A} & & & & & \\
\cmidrule{3-7}
Text \\
\midrule
Text \\
\midrule
Text & \Block[fill=myTableColor]{2-1}{A} & & & & & \\
\cmidrule{3-7}
Text \\
\bottomrule
\end{NiceTabularX}
\end{document}
Você precisa de várias compilações (porque nicematrix
usa nós PGF/Tikz nos bastidores).