Despite searching the forum, I still can't figure out how to control the internal cell left and right margins. In the example below, how can I tweak (e.g. reduce) the left margin for the "L-text" cells, and the right margin for the "R-text" ones? Note that defining the column widths is required. Thanks, Jorge.
Example:
\documentclass[margin=3mm]{standalone}
\usepackage{array}
\usepackage{booktabs}
\aboverulesep=0ex
\belowrulesep=0ex
\newlength{\ColWidthNormal} \setlength{\ColWidthNormal}{1.50cm}
\newlength{\ColWidthRowHeader} \setlength{\ColWidthRowHeader}{1.50cm}
\newlength{\RuleOffsetLeft} \setlength{\RuleOffsetLeft}{-0.4pt}
\newlength{\RuleThicknessNormal} \setlength{\RuleThicknessNormal}{1.0pt}
\newcolumntype{C}{>{\centering\arraybackslash\leavevmode}p{\ColWidthNormal}}
\newcolumntype{R}{>{\raggedleft\arraybackslash}p{\ColWidthNormal}}
\newcolumntype{L}{>{\raggedright\arraybackslash}p{\ColWidthRowHeader}}
\begin{document}
\begin{tabular}{
|L|R|R|
}
\cmidrule[\RuleThicknessNormal](l{\RuleOffsetLeft}){2-3}
\multicolumn{1}{c|}{}& \multicolumn{1}{c|}{C-text}& \multicolumn{1}{c|}{C-text} \\
\midrule[\RuleThicknessNormal]
L-text& R-text& R-text \\
\midrule[\RuleThicknessNormal]
L-text& R-text& R-text \\
\midrule[\RuleThicknessNormal]
\end{tabular}
\end{document}
Output:
Update: the solution with \hspace
doesn't work below a minimum column width! Any ideas on how to solve this?
Code:
\documentclass[margin=3mm]{standalone}
\usepackage{array}
\usepackage{booktabs}
\aboverulesep=0ex
\belowrulesep=0ex
\newlength{\ColWidthNormal} \setlength{\ColWidthNormal}{1.50cm}
%\newlength{\ColWidthRowHeader} \setlength{\ColWidthRowHeader}{1.50cm}
\newlength{\ColWidthRowHeader} \setlength{\ColWidthRowHeader}{1.00cm}
\newlength{\RuleOffsetLeft} \setlength{\RuleOffsetLeft}{-0.4pt}
\newlength{\RuleThicknessNormal} \setlength{\RuleThicknessNormal}{1.0pt}
\newcolumntype{C}{>{\centering\arraybackslash\leavevmode}p{\ColWidthNormal}}
\newcolumntype{R}{>{\raggedleft\arraybackslash}p{\ColWidthNormal}}
\newcolumntype{L}{>{\raggedright\arraybackslash}p{\ColWidthRowHeader}}
\begin{document}
\setlength{\tabcolsep}{3pt}
\begin{tabular}{
|@{\hspace{0pt}}L|
R@{\hspace{-3pt}}|
R@{\hspace{-12pt}}|
}
\cmidrule[\RuleThicknessNormal](l{\RuleOffsetLeft}){2-3}
\multicolumn{1}{c|}{}& \multicolumn{1}{c|}{My C-text}& \multicolumn{1}{c|}{My C-text} \\
\midrule[\RuleThicknessNormal]
L-text& R-text& R-text \\
\midrule[\RuleThicknessNormal]
L-text& R-text& R-text \\
\midrule[\RuleThicknessNormal]
\end{tabular}
\end{document}
Output: