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

Post by ghostanime2001 »

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

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Using boolean Values

Post by cgnieder »

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

Code: Select all

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{array}
\usepackage[version=3]{mhchem}

\begin{document}

\begingroup
\setlength\extrarowheight{1ex}
\begin{tabular}{>{$}c<{$}*{3}{|>{$}c<{$}}}
        & \ce{CH3COOH <=>} & \ce{CH3COO- +} & \ce{H+} \\\hline
 \ce{I} & 0  & 1   & 0.48 \\
 \ce{C} & +x & -x  & -x \\
 \ce{E} & x  & 1-x & 0.48-x
\end{tabular}
\endgroup

\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

Re: Using boolean Values

Post by ghostanime2001 »

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: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Using boolean Values

Post by cgnieder »

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 \\:

Code: Select all

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{array}
\usepackage[version=3]{mhchem}

\begin{document}

\begingroup
\setlength\extrarowheight{1ex}
\begin{tabular}{>{$}c<{$}*{3}{|>{$}c<{$}}}
  & \ce{CH3COOH <=>} & \ce{CH3COO- +} & \ce{H+} \\[.5ex]
 \hline
  \ce{I} & 0  & 1   & 0.48 \\
  \ce{C} & +x & -x  & -x \\
  \ce{E} & x  & 1-x & 0.48-x
\end{tabular}
\endgroup

\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

Re: Using boolean Values

Post by ghostanime2001 »

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.
Post Reply