5

I would like to know if there is a way to align the content of a column along the position of a \div symbol. I know how to do it if there is a comma, but I don't know how to align along a different symbol.

\small
\begin{tabular}{lccccc}
\toprule
\textsc{Schema impiantistico} & $P_e$ [MW] & $\eta_I$ [\%] & $\eta_e$ [\%] & $\eta_t$ [\%] & $I_e$ \\ 
\midrule
Turbina a vapore a contropressione & $1\div 25$ & 88 & 15 & 73 & 0.17 \\ 
Turbina a vapore a condensazione e spillamento & $10\div 500$ & 65 & 30 & 35 & 0.46 \\ 
\midrule
Motore alternativo a recupero integrale & $0.1\div 10$ & 86 & 40 & 46 & 0.47 \\ 
Motore alternativo a recupero ad alta T & $0.1\div 10$ & 65 & 40 & 25 & 0.62 \\ 
Turbina a gas a recupero semplice & $1\div 100$ & 80 & 30 & 50 & 0.38 \\ 
Turbina a gas con post-combustione & $1\div 100$ & 83 & 25 & 58 & 0.30 \\ 
Turbina a gas con iniezione vapore & $5\div 60$ & 50 & 45 & 5 & 0.90 \\ 
Ciclo combinato (contropressione) & $20\div 50$ & 80 & 45 & 35 & 0.56 \\ 
Ciclo combinato (condensazione e spillamento) & $50\div 400$ & 70 & 50 & 20 & 0.71 \\ 
\bottomrule
\end{tabular} 
\end{table}
1
  • 1
    Welcome to TeX.SX! You can have a look on our our starter page to familiarize yourself further with our format. A tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button ({}) or hit Ctrl+K. Jul 2 '13 at 9:03
6

You can use the dcolumn package; however, instead of \div in the body of the table you need to choose an alphabetic symbol (here ?).

\documentclass{article}
\usepackage{booktabs,dcolumn}
\begin{document}
\small
\begin{tabular}{l D{?}{\,\div\,}{3.3} ccccc}
\toprule
\textsc{Schema impiantistico} &
 \multicolumn{1}{c}{$P_e$ (MW)} &
 $\eta_I$ (\%) &
 $\eta_e$ (\%) &
 $\eta_t$ (\%) &
 $I_e$ \\
\midrule
Turbina a vapore a contropressione             &  1  ?  25 & 88 & 15 & 73 & 0.17 \\
Turbina a vapore a condensazione e spillamento & 10  ? 500 & 65 & 30 & 35 & 0.46 \\
\midrule
Motore alternativo a recupero integrale        & 0.1 ?  10 & 86 & 40 & 46 & 0.47 \\
Motore alternativo a recupero ad alta T        & 0.1 ?  10 & 65 & 40 & 25 & 0.62 \\
Turbina a gas a recupero semplice              & 1   ? 100 & 80 & 30 & 50 & 0.38 \\
Turbina a gas con post-combustione             & 1   ? 100 & 83 & 25 & 58 & 0.30 \\
Turbina a gas con iniezione vapore             & 5   ?  60 & 50 & 45 &  5 & 0.90 \\
Ciclo combinato (contropressione)              & 20  ?  50 & 80 & 45 & 35 & 0.56 \\
Ciclo combinato (condensazione e spillamento)  & 50  ? 400 & 70 & 50 & 20 & 0.71 \\
\bottomrule
\end{tabular}
\end{document}

enter image description here

3
  • 1
    Don't forget to read the starter guide. Alla prossima!
    – egreg
    Jul 2 '13 at 9:51
  • @egreg It's possible to do the same in longtable?
    – lbautista
    Jul 7 '16 at 18:34
  • 1
    @lbautista Yes, sure.
    – egreg
    Jul 7 '16 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.