TransWikia.com

columns horizontal alignment

TeX - LaTeX Asked on May 28, 2021

good afternoon.

How can I leave the final 2 columns, evenly spaced horizontally?

Here is the code:

documentclass{article}
usepackage{array,multirow,amsmath}
providecommandlegend[1]{#1} % ??
begin{document}
begin{table}[!h] 
caption{Análise de Sensibilidade dos parâmetros $overline{N u}_{L_{p}}$ 
  e $R a_{L_{P}}$, em função das respectivas incertezas de medição 
  de influência.} 
begin{tabular}{c|c|c|c|c|c|c|c}
hline 
multirow{2}{*}{begin{tabular}[c]{@{}c@{}}%
   Variação Percentual da 
   Incerteza de Medição
   end{tabular}} & 
multicolumn{5}{c|}{Variação Percentual do $delta_{overline{N u}_{L_{p}}}$, conforme 
   variações nas incertezas:}                                                      
& multicolumn{2}{c}{Variação Percentual do $delta_{R a_{L_{p}}}$, 
   conforme variações nas incertezas:}                                   
 
cline{2-8} 
& $delta _{C_{t}}$ 
& $delta _{m_{P}}$ 
& $delta _{L_{P}}$ 
& $delta _{epsilon}$ 
& $delta _{overline{T}_{text {inicial}}} = 
  delta _{overline{T}_{text {final}}} = 
  delta _{overline{T}_{infty}}$ 
& $delta _{L_{P}}$ 
& $delta _{overline{T}_{text {inicial}}} = 
  delta _{overline{T}_{text {final}}} = 
  delta _{overline{T}_{infty}}$ 
 hline
-90% & -0,1058% & -0,0797% & -0,0029% & -88,0945%   & -0,0204% & -0,0879% & -89,1567%                                      
 hline
-75% & -0,1002% & -0,0755% & -0,0028% & -74,2216%   & -0,0193% & -0,0833% & -74,6693%                                      
 hline
-50% & -0,0801% & -0,0604% & -0,0022% & -49,6848%   & -0,0154% & -0,0666% & -49,8670%                                      
 hline
-25% & -0,0467% & -0,0352% & -0,0013% & -24,8771%   & -0,0090% & -0,0388% & -24,9482%                                      
 hline
+25% & 0,0601%  & 0,0453%  & 0,0017%  &  24,9051%   & 0,0116%  & +0,0499% & +24,9600%                                      
 hline
+50% & 0,1334%  & 0,1006%  & 0,0037%  & 49,8242%    & 0,0257%  & +0,1109% & +49,9260%                                      
 hline
+75% & 0,2200%  & 0,1659%  & 0,0061%  & 74,7514%    & 0,0424%  & +0,1829% & +74,8953%                                      
 hline
+90% & 0,2784%  & 0,2099%  & 0,0077%  & 89,7102%    & 0,0537%  & +0,2314% & +89,8780%                                      
 hline
+100%& 0,3199%  & 0,2412%  & 0,0088%  & 99,6835%    & 0,0617%  & +0,2660% & +99,8668%                                      
 hline 
end{tabular} 
label{tab:sensib} 
legend{Fonte: Próprio Autor.} 
end{table} 
%FloatBarrier % ??
end{document}

I thank the help of all you.

One Answer

The main problem is long text in the headers stretch the columns very wide. I've replaced the header text of the last two columns with

multicolumn{2}{c}{
    parbox{16em}{
        centeringsmallskip
        Variação Percentual do $delta_{R a_{L_{p}}}$,
        conforme variações nas incertezas:
        smallskip
    }
}

which restricts the text to 16em (roughly 20 capital letters wide).

Long table columns better

(Note it's missing the legend. I don't know what you packages you're using for that.)

Additionally, I've made the columns equally wide (except for the long $delta ... = delta ... = delta ...$ ones). This is done by adding before your begin{document} the code

usepackage{array}

newcolumntype{P}{>{centeringarraybackslash}p{6em}}

Now instead of the c column alignment, we can also use P. This is also a centered column, but precisely 6em wide. I replace your {c|c|...|c} by {c|P|P|P|P|c|P|c}. This gives the result shown.

The full code behind this image (also on pastebin: https://pastebin.com/8StLqGUm):

% Source: https://tex.stackexchange.com/questions/598089/columns-horizontal-alignment/598091#598091
documentclass[a4paper,landscape]{article}
 
usepackage{graphicx}
usepackage{multirow}
usepackage{amsmath,amssymb}
usepackage[margin=2.5cm]{geometry}
usepackage{array}
 
newcolumntype{P}{>{centeringarraybackslash}p{6em}}
 
begin{document}
    begin{table}[!h]
        caption{Análise de Sensibilidade dos parâmetros $overline{N u}_{L_{p}}$ e $R a_{L_{P}}$, em função das respectivas incertezas de medição de influência.}
        %
        begin{tabular}{c*{4}{|P}|c*{1}{|P}|c}
        hline
        multirow{2}{*}{
            begin{tabular}[c]{@{}c@{}}Variação Percentual da Incerteza de Mediçãoend{tabular}} & 
            multicolumn{5}{c|}{
                Variação Percentual do $delta_{overline{N u}_{L_{p}}}$, conforme variações nas incertezas:
            }
&
multicolumn{2}{c}{
    parbox{16em}{
        centeringsmallskip
        Variação Percentual do $delta_{R a_{L_{p}}}$,
        conforme variações nas incertezas:
        smallskip
    }
}
 cline{2-8} 
                                                                                                               & $delta _{C_{t}}$ & $delta _{m_{P}}$ & $delta _{L_{P}}$ & $delta _{epsilon}$ & $delta _{overline{T}_{text {inicial}}} = delta _{overline{T}_{text {final}}} = delta _{overline{T}_{infty}}$ & $delta _{L_{P}}$ & $delta _{overline{T}_{text {inicial}}} = delta _{overline{T}_{text {final}}} = delta _{overline{T}_{infty}}$  hline
        -90%                                                                                                  & -0,1058%         & -0,0797%         & -0,0029%         & -88,0945%           & -0,0204%                                                                                                             & -0,0879%         & -89,1567%                                                                                                             hline
        -75%                                                                                                  & -0,1002%         & -0,0755%         & -0,0028%         & -74,2216%           & -0,0193%                                                                                                             & -0,0833%         & -74,6693%                                                                                                             hline
        -50%                                                                                                  & -0,0801%         & -0,0604%         & -0,0022%         & -49,6848%           & -0,0154%                                                                                                             & -0,0666%         & -49,8670%                                                                                                             hline
        -25%                                                                                                  & -0,0467%         & -0,0352%         & -0,0013%         & -24,8771%           & -0,0090%                                                                                                             & -0,0388%         & -24,9482%                                                                                                             hline
        +25%                                                                                                  & 0,0601%          & 0,0453%          & 0,0017%          & 24,9051%            & 0,0116%                                                                                                              & +0,0499%         & +24,9600%                                                                                                             hline
        +50%                                                                                                  & 0,1334%          & 0,1006%          & 0,0037%          & 49,8242%            & 0,0257%                                                                                                              & +0,1109%         & +49,9260%                                                                                                             hline
        +75%                                                                                                  & 0,2200%          & 0,1659%          & 0,0061%          & 74,7514%            & 0,0424%                                                                                                              & +0,1829%         & +74,8953%                                                                                                             hline
        +90%                                                                                                  & 0,2784%          & 0,2099%          & 0,0077%          & 89,7102%            & 0,0537%                                                                                                              & +0,2314%         & +89,8780%                                                                                                             hline
        +100%                                                                                                 & 0,3199%          & 0,2412%          & 0,0088%          & 99,6835%            & 0,0617%                                                                                                              & +0,2660%         & +99,8668%                                                                                                             hline
        end{tabular}
        label{tab:sensib}
        %legend{Fonte: Próprio Autor.}
    end{table}
end{document}

Answered by Vincent Kuhlmann on May 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP