Math & Scienceeqnarray variable kerning

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
RSKueffner
Posts: 5
Joined: Thu Feb 25, 2010 9:16 am

eqnarray variable kerning

Post by RSKueffner »

Howdy. Straight to the issue, is there any method to align variables such that the kerning between them and their subscripts do not cause nonuniform widths? Here is an example of the problem:

Code: Select all

\begin{math}
  \vec{A} = a_1 a_1 a_1 a_1\\
  \vec{B} = b_1 b_1 b_1 b_1\\
\end{math}
If you render it, you will see that the a components go much further right than the b components.

I am afraid my situation is more complicated than just setting up an array as an array would require \multicolumn to emulate \lefteqn. But I would then have the same situation of aligning all the components in each \multicolumn.

If I were to make arrays in arrays, I could manually set column widths, but this seems quite sloppy.

All I really need is a method to make b_i the same width as a_i. Will I need to embed all my variables in a fixed width \mbox?

Thanks for the support.

I have attempted using align and eqnarray but find that an array/table is the only work around.

Recommended reading 2024:

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

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

CrazyHorse
Posts: 351
Joined: Sat Aug 02, 2008 8:47 am

eqnarray variable kerning

Post by CrazyHorse »

RSKueffner wrote: If you render it, you will see that the a components go much further right than the b components.

I am afraid my situation is more complicated than just setting up an array as an array would require \multicolumn to emulate \lefteqn. But I would then have the same situation of aligning all the components in each \multicolumn.

If I were to make arrays in arrays, I could manually set column widths, but this seems quite sloppy.
That is the default behaviour ...

Code: Select all

\listfiles
\documentclass{article}
\usepackage{amsmath}

\newsavebox\CBox
\sbox\CBox{$a$}
\def\b{\makebox[\wd\CBox][r]{$b$}}
\begin{document}

\begin{align*}
  \vec{A} &= a_1 a_1 a_1 a_1\\
  \vec{B} &= \b_1 \b_1 \b_1 \b_1
\end{align*}

\begin{align*}\arraycolsep=0pt
 \begin{array}{r@{\,}c@{\,}llll}
  \vec{A} &= &a_1 &a_1 &a_1 &a_1\\
  \vec{B} &= &b_1 &b_1 &b_1 &b_1
 \end{array}
\end{align*}

\begin{align*}\arraycolsep=0pt
 \begin{matrix}
  \vec{A} &\,=\, &a_1 &a_1 &a_1 &a_1\\
  \vec{B} &\,=\, &b_1 &b_1 &b_1 &b_1
 \end{matrix}
\end{align*}

\end{document}
Herbert
RSKueffner
Posts: 5
Joined: Thu Feb 25, 2010 9:16 am

eqnarray variable kerning

Post by RSKueffner »

Sorry for the delay in response; I have been preoccupied with my studies. Thank you for your response. In short, I have reverted to a previous solution. The code follows for those who may need it.

Code: Select all

\begin{array}{ll r@{\,} c @{\,}c@{\,} c @{\,}c@{\,} c @{\,}l @{\,}c}
 \multicolumn{9}{l}{\vec{A} \wedge \vec{B} \wedge \vec{C} =}        \\
 && (& a_1 \hat{e}_1 &+& a_2 \hat{e}_2 &+& a_3 \hat{e}_3 &)& \wedge \\
 && (& b_1 \hat{e}_1 &+& b_2 \hat{e}_2 &+& b_3 \hat{e}_3 &)& \wedge \\
 && (& c_1 \hat{e}_1 &+& c_2 \hat{e}_2 &+& c_3 \hat{e}_3 &)&        \\
\end{array} 
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

eqnarray variable kerning

Post by localghost »

Now that the problem is solved, please be so kind and mark the topic (not the last post) accordingly as clearly written in Section 3 of the Board Rules (to be read before posting). Please keep that in mind for the future so that a reminder will not be necessary anymore.


Best regards
Thorsten
RSKueffner
Posts: 5
Joined: Thu Feb 25, 2010 9:16 am

Re: eqnarray variable kerning

Post by RSKueffner »

Sure thing, apologies for the inconvenience, I presume this has been done and such is what the green check-mark signifies? I fail to see the edit button anywhere but on my most recent post.
Post Reply