LaTeX forum ⇒ Graphics, Figures & TablesAlign Equal Signs in Table Column Topic is solved

Information and discussion about graphics, figures & tables in LaTeX documents.
NELLLY
Posts: 113
Joined: Thu Nov 26, 2009 2:21 am

Align Equal Signs in Table Column

Postby NELLLY » Thu Jun 13, 2013 11:17 am

Good morning,

I have the following table, after execution the signs "=" in the first column of the table are not aligned, what could I do to make them so?
  1. \documentclass[11pt,a4paper,english]{article}
  2. \usepackage[T1]{fontenc}
  3. \usepackage[latin1]{inputenc}
  4. \usepackage{babel}
  5. \usepackage[includeheadfoot,margin=2cm]{geometry}
  6. \usepackage[font=small,labelfont=bf,tableposition=top]{caption}
  7. \usepackage{booktabs,multirow}
  8. \begin{document}
  9. \setlength{\tabcolsep}{0.8cm}
  10. \begin{table}[bth]
  11. \caption{Level planning of the input parameters} \centering
  12. \begin{tabular}{ccc}\toprule[1.2pt]
  13. \multirow{2}{*}{ Model parameter}
  14. &\multicolumn{2}{c}{Level}\\\cmidrule{2-3}
  15. &Low&High\\\midrule[1.2pt]
  16. $A=p_0$&0.03&0.08 \\
  17. $B=\delta$&0.5&1\\
  18. $C=L_0$&50&250\\
  19. $D=L_1$&500&700\\
  20. $E=\lambda$&0.001&0.008\\
  21. $F=M$&80&160\\
  22. $G=b$&0&1\\
  23. $H=c$&0.1&0.5\\
  24. \bottomrule[1.2pt]
  25. \label{Factorlevels}
  26. \end{tabular}
  27. \end{table}
  28. \end{document}

Tags:

User avatar
tom
Posts: 73
Joined: Thu Apr 18, 2013 4:02 am

Postby tom » Fri Jun 14, 2013 10:42 am

Hi,

Right now, you center-align the first column. Because the content of each cell has different length, the equations are miss-aligned. You could left-align the first column which doesn't fix the problem entirely, due to the differences in letter width.

  1. \begin{tabular}{lcc}\toprule[1.2pt]


I suggest the use of separate columns.

  1. \documentclass[11pt,a4paper,english]{article}
  2. \usepackage[T1]{fontenc}
  3. \usepackage[latin1]{inputenc}
  4. \usepackage{babel}
  5. \usepackage[includeheadfoot,margin=2cm]{geometry}
  6. \usepackage[font=small,labelfont=bf,tableposition=top]{caption}
  7. \usepackage{booktabs,multirow, array}
  8. \begin{document}
  9. \setlength{\tabcolsep}{0.8cm}
  10. \begin{table}[bth]
  11. \caption{Level planning of the input parameters} \centering
  12. \begin{tabular}{r@{$\:$}lcc}\toprule[1.2pt]
  13. \multicolumn{2}{l}{\multirow{2}{*}{Model parameter}}&\multicolumn{2}{c}{Level}\\\cmidrule{3-4}
  14. &&Low&High\\\midrule[1.2pt]
  15. $A$&$=p_0$&0.03&0.08 \\
  16. $B$&$=\delta$&0.5&1\\
  17. $C$&$=L_0$&50&250\\
  18. $D$&$=L_1$&500&700\\
  19. $E$&$=\lambda$&0.001&0.008\\
  20. $F$&$=M$&80&160\\
  21. $G$&$=b$&0&1\\
  22. $H$&$=c$&0.1&0.5\\
  23. \bottomrule[1.2pt]
  24. \label{Factorlevels}
  25. \end{tabular}
  26. \end{table}
  27. \end{document}

NELLLY
Posts: 113
Joined: Thu Nov 26, 2009 2:21 am

Postby NELLLY » Fri Jun 21, 2013 1:47 am

Many thanks. your proposed solution works perfectly.


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 5 guests