How to align this vertical line at the end of the multi-column?
I searched, but I could not find an answer for such problem. This was originated from How to fix this Package array Error: Only one column-spec allowed?
\documentclass[12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[brazil]{babel}
\usepackage[a4paper, margin=2cm]{geometry}
\usepackage{newtxtext,newtxmath}
\usepackage{array,ragged2e,tabularx,multirow}
\begin{document}
\section{Custos}
\begin{tabular}
{|
*1{@{\hspace{3.0pt}}>{ \RaggedRight\arraybackslash\hsize=1.1\hsize }p{3.9cm}|} % Item
*1{@{\hspace{3.0pt}}>{ \RaggedRight\arraybackslash\hsize=1.1\hsize }p{1.9cm}|} % Quantidade
*1{@{\hspace{3.0pt}}>{ \RaggedRight\arraybackslash\hsize=1.1\hsize }p{3.0cm}|} % Valor
*1{@{\hspace{3.0pt}}>{ \RaggedRight\arraybackslash\hsize=1.1\hsize }p{2.6cm}|} % Valor
}
\hline Item & Quantidade & Valor Unitário (R\$) & Valor Total (R\$) \\ \hline
Total & \multicolumn{2}{c|}{} & 165,00 \\ \hline
\end{tabular}
\end{document}
Update 1
I find another question which seems to have the same problem, but it is not easy to understand what they did to fix it. I have to open my diff program to compare the original code and the fixed code:
On the right there is the fixed code, on the left is the original code.
That table goes from this:
Into this:
Update 2
By @David Carlisle comment, I find out that the question mentionated on the Update 1
is different from this one:
the edited question is an entirely different issue, please don't change the question that way invalidating all posted answers. The added question is the common issue of putting | on the wrong side of the cell boundary, the original question is unrelkated to that and just about your mis-use of
Best Answer
Your preamble has obscured the necessary column spec:
I left in the
\hsize=1.1\hsize
but it is completely wrong! Also as commented under the question, the@
usage here is making the vertical rules no longer centred in the inter-column space.