Text Formattingheight of text using \makebox

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

height of text using \makebox

Post by ghostanime2001 »

How can I set the height of C with the height of H+ ?

I have already defined a new lenght \co as the height of H+ but it doesn't work with \makebox even though \makebox can take \height or \totalheight as an optional argument.

Code: Select all

Code, edit and compile here:
\documentclass{article}
\usepackage[version=3]{mhchem}
\newlength{\co}
\settoheight{\co}{\ce{H+}}
\begin{document}
\fbox{\makebox[\co]{C}} \fbox{\ce{H+}}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Recommended reading 2024:

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

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

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

Re: height of text using \makebox

Post by ghostanime2001 »

Any suggestions ?
User avatar
NoIdeaNickanme
Posts: 13
Joined: Wed Nov 09, 2011 5:41 pm

height of text using \makebox

Post by NoIdeaNickanme »

Hi!
This may not be a conventional solution, however using tabular environment and \hhline within a \makebox does the trick.

Code: Select all

Code, edit and compile here:
\documentclass{article}
\usepackage[version=3]{mhchem}
\usepackage{hhline}
\begin{document}
\makebox{
\begin{tabular}{|c|}
\hhline{-}
C\\
\hhline{-}
\end{tabular}
}
\makebox{
\begin{tabular}{|c|}
\hhline{-}
\ce{H+}\\
\hhline{-}
\end{tabular}
}
\end{document}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
If you still have problems with height, use tabulary environment instead.
Post Reply