LaTeX forum ⇒ GeneralUsing boolean Values

LaTeX specific issues not fitting into one of the other forums of this category.
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Re: Using boolean Values

Postby ghostanime2001 » Sat Mar 09, 2013 10:46 pm

The third tabular table seems too cramped but I like the first table, the horizontal line seems just a little bent

Tags:

User avatar
cgnieder
Site Moderator
Posts: 1993
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Sat Mar 09, 2013 11:50 pm

If it looks too cramped you can adjust that, for example this way:

  1. \documentclass{article}
  2. \usepackage[T1]{fontenc}
  3. \usepackage{array}
  4. \usepackage[version=3]{mhchem}
  5.  
  6. \begin{document}
  7.  
  8. \begingroup
  9. \setlength\extrarowheight{1ex}
  10. \begin{tabular}{>{$}c<{$}*{3}{|>{$}c<{$}}}
  11. & \ce{CH3COOH <=>} & \ce{CH3COO- +} & \ce{H+} \\\hline
  12. \ce{I} & 0 & 1 & 0.48 \\
  13. \ce{C} & +x & -x & -x \\
  14. \ce{E} & x & 1-x & 0.48-x
  15. \end{tabular}
  16. \endgroup
  17.  
  18. \end{document}


The \begingroup ... \endgroup is only to keep the setting of \extrarowheight local. It is unnecessary if the whole table is inside of an environment.

Regards
site moderator & package author

ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Postby ghostanime2001 » Sun Mar 10, 2013 1:59 am

I need a little more space between the top row compounds and the horizontal line also set by the same amount of row separation

User avatar
cgnieder
Site Moderator
Posts: 1993
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Sun Mar 10, 2013 10:50 am

ghostanime2001 wrote:I need a little more space between the top row compounds and the horizontal line

Well, as you hopefully know you can specify an additional vertical skip in the optional argument of \\:
  1. \documentclass{article}
  2. \usepackage[T1]{fontenc}
  3. \usepackage{array}
  4. \usepackage[version=3]{mhchem}
  5.  
  6. \begin{document}
  7.  
  8. \begingroup
  9. \setlength\extrarowheight{1ex}
  10. \begin{tabular}{>{$}c<{$}*{3}{|>{$}c<{$}}}
  11. & \ce{CH3COOH <=>} & \ce{CH3COO- +} & \ce{H+} \\[.5ex]
  12. \hline
  13. \ce{I} & 0 & 1 & 0.48 \\
  14. \ce{C} & +x & -x & -x \\
  15. \ce{E} & x & 1-x & 0.48-x
  16. \end{tabular}
  17. \endgroup
  18.  
  19. \end{document}

ghostanime2001 wrote:also set by the same amount of row separation

I don't understand what you mean by that...

Regards
site moderator & package author

ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

Postby ghostanime2001 » Mon Mar 11, 2013 10:32 pm

What I meant to say was I wanted the same amount of whitespace between rows as between the first line of compounds and horizontal rule.


Return to “General”

Who is online

Users browsing this forum: No registered users and 8 guests