2

Well, surely this is a duplicate, but I have troubles with the alignment of a huge table. In fact my problem is to determine the width of each column properly, especially when the columns are narrow, and the justification by default generates a rather unpleasant visual appearance. I also have the problem that the multirow package generates columns too narrow and I can't get a right presentation.

The only tool I use (so far) is p{width} that has the defect to justify the text of the column width and when it is scarce, the visual aspect is pretty bad. So the question is, in such cases, is there any alternative to adjust the width of a narrow column without being justified?

My MWE:

   \documentclass[fontsize=12pt,paper=letter,headings=small,bibliography=totoc,DIV=12,headsepline=true,titlepage=on]{scrartcl}
    \usepackage{soul}   
    \usepackage[spanish,mexico]{babel} 
    \usepackage{fontspec} 
    \defaultfontfeatures{Ligatures=TeX}
    \usepackage{xunicode}    
    \setmainfont[
    ItalicFont = SourceSerifPro,
    ItalicFeatures={FakeSlant=0.2}
    ]{SourceSerifPro} 
    \setsansfont{SourceSansPro}
    \setmonofont{SourceCodePro}    
    \usepackage{xspace}
    \usepackage{xkeyval}
    \usepackage{array,multirow,multicol,rotating,tabularx,ragged2e,booktabs,ltablex,afterpage} 
    \newcolumntype{Z}{>{\RaggedLeft\arraybackslash\hspace{0pt}}X}
    \newcolumntype{Y}{>{\RaggedRight\arraybackslash}X}
    %\newcolumntype{C}{>{\centering\arraybackslash\hspace{0pt}}X}
    \newcolumntype{C}{>{\centering\arraybackslash}X} 
    \newcommand\mc[1]{\multicolumn{2}{@{}C@{}}{#1}}  
    \usepackage{rotating} 
    \usepackage{colortbl} 
    \usepackage[per-mode=symbol]{siunitx} 
    \sisetup{
    output-decimal-marker = {.},
    group-minimum-digits = 4,
    range-units = brackets,
    list-final-separator = { \translate{and} },
    list-pair-separator = { \translate{and} },
    %range-phrase = { \translate{to (numerical range)} },
    range-phrase={\,a\,}
    }
    \ExplSyntaxOn
    \providetranslation [ to = Spanish ]
    { to~(numerical~range) } { a }%substitute the right word here
    \ExplSyntaxOff    
    \usepackage{makecell}
    \renewcommand\theadfont{\bfseries}
    \renewcommand\theadalign{bc}
    \setcellgapes{1.5pt}

\begin{document}
    {
\captionof{table}{Gasoductos}
\label{tab:GasoIns}
\begin{tabularx}{\linewidth}{@{} p{0.16\linewidth} p{0.2\linewidth} p{50pt}
S[table-format=4.1]
S[table-format=5.1]
S[table-format=7.1]
S[table-format=5.1]
p{50pt}
  @{}}
\toprule
Permisario & Localización & Inicio de  & {Longitud} & {Volumen} & {Volumen} & {Inversión\footnote{A millones de dólares de 2014.}} & Estatus \\
       &              & Operaciones &           &{Promedio} & {Promedio}&             &         \\
       &              &                    & {\si{\kilo\metre}} & {\si{\milli\metre^3\day}} & {(MMpcd)} & {(Mdd)} \\                   
\midrule
\endfirsthead

\toprule
Permisario & Localización & Inicio de  & {Longitud} & {Volumen} & {Volumen} & {Inversión} & Estatus \\
&             & Operaciones &           &{Promedio} & {Promedio}&             &         \\
&             &                    & {\si{\kilo\metre}} & {\si{\milli\metre^3\day}} & {(MMpcd)} & {(Mdd)} \\                   
\midrule
\endhead

Gasoductos de Chihuahua & San Isidro-Samalayuca & Dic-97 & 37.7 & 5663.4 & 200.0  & 15.7 & Operando \\
Igasamex San José Iturbide & Himilpan-San Luis Potosí & Mar-98 & 3.0 & 13643.5 & 482.0 &  & Operando \\
FINSA Energéticos & Matamoros, Tamaulipas & Jun-98 & 8.4 & 36.2 & 1.3 & 0.9 & Operando \\
Pemex Gas y Petroquímica Básica & Naco-Hermosillo, Son. & Mar-99 & 339.0 & 3113.0 & 109.9 & 22.1 & Operando \\
Pemex Gas y Petroquímica Básica & Sectores Cárdenas, Minatitlán, Veracruz, Cd.Mendoza, Tlaxcala, V. de Carpio, Salamanca, Guadalajara, Madero, Reynosa, Monterrey, Torreon y Chihuahua & Jun-99 & 8704.0 & 140035.1 & 4945.3 & 1430.3 & Operando \\
Energía Mayakan & Tabasco, Chiapas, Campeche, Valladolid, Yucatán & Sep-99 & 710.0 & 4247.0 & 150.0 & 303.0 & Operando \\
Transportadora de GN de Baja California & Otay, San Diego-Rosarito, Baja California & Jun-00 & 45.0 & 26621.0 & 940.0 & 64.8 & Operando\\
Gasoductos del Bajío & Salamanca-Aguascalientes  & Abr-01 & 204.0 & 606529.0 & 21419.3 & 39.5 & Operando \\
Gasoducto Rosarito & Los Algodones-Baja California & Sep-02 & 302.0 & 40610.0  & 1434.0 & 275.1 & Operando \\
Gasoducto Agua Prieta & Frontera México-EUA-Naco, Sonora & Dic-02 & 13.0 & 5664.0 & 200.0  & 7.7 & Operando \\
Tejas de Gas de Toluca & Palmillas-Toluca, Edo de México & Feb-03 & 123.2 & 77.0 & 2.7 & 31.0  & Operando \\
Kinder Morgan & Cd. Mier, Tamaulipas-Huinalá, Nuevo León & Mar-03 & 137.0 & 10479.3 & 370.0 & 4.1  & Operando \\
Gasoductos del Río & Frontera México - EUACCC Rio Bravo II, III y IV y Portes Gil, Tamaulipas & Ago-03 & 57.9 & 11.6 & 0.4  & 39.3 & Operando \\
Gasoductos de Tamaulipas & Reynosa-San Fernando & Nov-03 & 114.0 & 28317.0 & 1000.0 & 222.0 & Operando \\ 
Conceptos Energéticos Mexicanos & Carretera Federal Mexicali Tijuana & Dic-03 & 1.8 & 13779.0 & 486.0 &  & Operando \\
Transportadora de Gas Natural de la Huasteca & Naranjos Veracruz-Tamazunchale, S.L.P. & Dic-06 & 127.0 & 5097.0 & 180.0 & 181.0 & Operando \\ 
Energía Occidente de México, S. de R. L. de C. V. & Manzanillo-Colima Guadalajara, Jalisco & Jun-11 & 307.0 & 8495.1 & 300.0 & 360.0 & Operando \\
Tarahumara Pipeline, S. de R. L. de C. V. & Cd. Juárez-Chihuahua & Jul-13 & 389.0 & 1940.0 & 68.5 & 368.8 & Operando \\ 
Tejas Gas de la Península & Valladolid, Campeche Nizuc, Quintana Roo & n/a & & & & & En construcción \\ 
Gasoducto de Morelos & Esperanza-Venta de Carpio y Cempoala-Santa Ana & & 9542.0 & 1142.0 & 337.0  & 246.0 & En construcción \\ 
\multirow{2}{0.16\linewidth}{Gasoducto del Noreste, S. de R.L. de C.V.} & \multirow{2}{0.2\linewidth}{Agua Dulce-Los Ramones} & 1ª etapa: Dic 14 & \multirow{2}{*}{83283.0\footnote{1ª etapa: \num{28317};}} & \multirow{2}{*}{3100.0\footnote{2ª etapa \num{54966}.} } & 587.0 & 116.8 & \multirow{2}{*}{En construcción} \\ 
           &               &   2ª Etapa: Dic 15 & & & & & \\    
%\multirow{3}{0.16\linewidth}{Gasoducto de Aguaprieta} & Sasabe-Puerto Libertad & Oct-14  & 220.0 & 21806.4 & 770.0 & 172.6 & \multirow{3}{p{50pt}}{En construcción} \\
%& Puerto Libertad-Guaymas & Oct-15 & 285.0 & 14443.2 & 510.0 & 196.1 & \\
%& Guaymas-El Oro         & Ago-16 & 328.0 & 14443.2 & 510.0 &  83.7 & \\
Transportadora de Gas Natural de Zacatecas & Aguascalientes-Calera, Zacatecas & Jul-14 & 175.0 & 566.0 & 20.0 & 70.0 & En construcción \\
\addlinespace
& Total nacional & & 1058442.0 & 13889.8 & 37536.4 & 4720.9 & \\
\bottomrule     
\end{tabularx}
}
\end{document}

I commented an attempt to use multirow within the table because it generates a compilation error. What do you suggest me to fix this mess?

1 Answer 1

2

It doesn't work to use tabularx with no X columns, but I wouldn't use tabularx here.

This is still a bit wide but not knowing the language I can't really abbreviate any more.

   \documentclass[fontsize=12pt,paper=letter,headings=small,bibliography=totoc,DIV=12,headsepline=true,titlepage=on]{scrartcl}
    \usepackage{soul}   
    \usepackage[spanish,mexico]{babel} 

    \usepackage{xspace}
    \usepackage{xkeyval}
    \usepackage{array,multirow,multicol,rotating,tabularx,ragged2e,booktabs,longtable} 
    \newcolumntype{Z}{>{\RaggedLeft\arraybackslash\hspace{0pt}}X}
    \newcolumntype{Y}{>{\RaggedRight\arraybackslash}X}
    %\newcolumntype{C}{>{\centering\arraybackslash\hspace{0pt}}X}
    \newcolumntype{C}{>{\centering\arraybackslash}X} 
    \newcommand\mc[1]{\multicolumn{2}{@{}C@{}}{#1}}  
    \usepackage{rotating} 
    \usepackage{colortbl} 
    \usepackage[per-mode=symbol]{siunitx} 
    \sisetup{
    output-decimal-marker = {.},
    group-minimum-digits = 4,
    range-units = brackets,
    list-final-separator = { \translate{and} },
    list-pair-separator = { \translate{and} },
    %range-phrase = { \translate{to (numerical range)} },
    range-phrase={\,a\,}
    }
    \ExplSyntaxOn
    \providetranslation [ to = Spanish ]
    { to~(numerical~range) } { a }%substitute the right word here
    \ExplSyntaxOff    
    \usepackage{makecell}
    \renewcommand\theadfont{\bfseries}
    \renewcommand\theadalign{bc}
    \setcellgapes{1.5pt}

\newcommand\hd[1]{%
\multicolumn{1}{c}{\begin{tabular}[t]{@{}c@{}}#1\end{tabular}}}
\begin{document}

\captionof{table}{Gasoductos}
\label{tab:GasoIns}

\setlength\tabcolsep{3pt}
\setlength\LTleft{-9pt plus 1fil}
\setlength\LTright{-9pt plus 1fil}
\begin{longtable}{@{}
>{\raggedright}p{0.16\linewidth}
>{\raggedright}p{0.2\linewidth}
l
S[table-format=4.1]
S[table-format=5.1]
S[table-format=7.1]
S[table-format=5.1]
l
  @{}}
\toprule
\hd{Permisario} &
\hd{Localización} & 
\hd{Inicio\\ de Oper-\\aciones} &
\hd{Longitud\\\si{\kilo\metre}} &
\hd{Volumen\\Promedio\\\si{\milli\metre^3\day}} & 
\hd{Volumen\\Promedio\\(MMpcd)} &
\hd{Inversión\footnote{A millones de dólares de 2014.}\\(Mdd)} & 
\hd{Esta-\\tus} \\
\midrule
\endfirsthead

\toprule
\hd{Permisario} &
\hd{Localización} & 
\hd{Inicio\\ de Oper-\\aciones} &
\hd{Longitud\\\si{\kilo\metre}} &
\hd{Volumen\\Promedio\\\si{\milli\metre^3\day}} & 
\hd{Volumen\\Promedio\\(MMpcd)} &
\hd{Inversión\\(Mdd)} & 
\hd{Esta-\\tus} \\
\midrule
\endhead

Gasoductos de Chihuahua & San Isidro-Samalayuca & Dic-97 & 37.7 & 5663.4 & 200.0  & 15.7 &Op. \\
Igasamex San José Iturbide & Himilpan-San Luis Potosí & Mar-98 & 3.0 & 13643.5 & 482.0 &  &Op. \\
FINSA Energéticos & Matamoros, Tamaulipas & Jun-98 & 8.4 & 36.2 & 1.3 & 0.9 &Op. \\
Pemex Gas y Petroquímica Básica & Naco-Hermosillo, Son. & Mar-99 & 339.0 & 3113.0 & 109.9 & 22.1 &Op. \\
Pemex Gas y Petroquímica Básica & Sectores Cárdenas, Minatitlán, Veracruz, Cd.Mendoza, Tlaxcala, V. de Carpio, Salamanca, Guadalajara, Madero, Reynosa, Monterrey, Torreon y Chihuahua & Jun-99 & 8704.0 & 140035.1 & 4945.3 & 1430.3 &Op. \\
Energía Mayakan & Tabasco, Chiapas, Campeche, Valladolid, Yucatán & Sep-99 & 710.0 & 4247.0 & 150.0 & 303.0 &Op. \\
Transportadora de GN de Baja California & Otay, San Diego-Rosarito, Baja California & Jun-00 & 45.0 & 26621.0 & 940.0 & 64.8 &Op.\\
Gasoductos del Bajío & Salamanca-Aguascalientes  & Abr-01 & 204.0 & 606529.0 & 21419.3 & 39.5 &Op. \\
Gasoducto Rosarito & Los Algodones-Baja California & Sep-02 & 302.0 & 40610.0  & 1434.0 & 275.1 &Op. \\
Gasoducto Agua Prieta & Frontera México-EUA-Naco, Sonora & Dic-02 & 13.0 & 5664.0 & 200.0  & 7.7 &Op. \\
Tejas de Gas de Toluca & Palmillas-Toluca, Edo de México & Feb-03 & 123.2 & 77.0 & 2.7 & 31.0  &Op. \\
Kinder Morgan & Cd. Mier, Tamaulipas-Huinalá, Nuevo León & Mar-03 & 137.0 & 10479.3 & 370.0 & 4.1  &Op. \\
Gasoductos del Río & Frontera México - EUACCC Rio Bravo II, III y IV y Portes Gil, Tamaulipas & Ago-03 & 57.9 & 11.6 & 0.4  & 39.3 &Op. \\
Gasoductos de Tamaulipas & Reynosa-San Fernando & Nov-03 & 114.0 & 28317.0 & 1000.0 & 222.0 &Op. \\ 
Conceptos Energéticos Mexicanos & Carretera Federal Mexicali Tijuana & Dic-03 & 1.8 & 13779.0 & 486.0 &  &Op. \\
Transportadora de Gas Natural de la Huasteca & Naranjos Veracruz-Tamazunchale, S.L.P. & Dic-06 & 127.0 & 5097.0 & 180.0 & 181.0 &Op. \\ 
Energía Occidente de México, S. de R. L. de C. V. & Manzanillo-Colima Guadalajara, Jalisco & Jun-11 & 307.0 & 8495.1 & 300.0 & 360.0 &Op. \\
Tarahumara Pipeline, S. de R. L. de C. V. & Cd. Juárez-Chihuahua & Jul-13 & 389.0 & 1940.0 & 68.5 & 368.8 &Op. \\ 
Tejas Gas de la Península & Valladolid, Campeche Nizuc, Quintana Roo & n/a & & & & & En c. \\ 
Gasoducto de Morelos & Esperanza-Venta de Carpio y Cempoala-Santa Ana & & 9542.0 & 1142.0 & 337.0  & 246.0 & En c. \\ 
Gasoducto del Noreste, S. de R.L. de C.V. & Agua Dulce-Los Ramones & 
\hd{1ª etapa:\\ Dic 14\\2ª Etapa:\\ Dic 15} & 83283.0\footnote{1ª etapa: \num{28317};} & 3100.0\footnote{2ª etapa \num{54966}.}  & 587.0 & 116.8 & En c. \\ 
Transportadora de Gas Natural de Zacatecas & Aguascalientes-Calera, Zacatecas & Jul-14 & 175.0 & 566.0 & 20.0 & 70.0 & En c. \\
\addlinespace
& Total nacional & & 1058442.0 & 13889.8 & 37536.4 & 4720.9 & \\
\bottomrule     
\end{longtable}

\end{document}
1
  • Thanks for your helping, so after read the code, I guess the answer to my question is: >{\raggedright}p{<width>} .
    – Aradnix
    Commented Sep 1, 2015 at 0:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .