2

I have a horizontal table, made with \longtable, with two cells: in the left cell there is text, and the right cell contains an equation I implemented with the \alignat command. If I use the attached code, a misalignment between the top sides of the left cell text and the right cell equation shows up:

\documentclass[11pt, a4paper, twoside, openright, titlepage]{book}
\usepackage[english]{babel}
\usepackage{amsmath,amssymb}
\usepackage{ltxtable}

\begin{document}

\newsavebox\try
\begin{lrbox}{\try}
    \begin{minipage}{0.5\textwidth}
        \begin{alignat}{3}
            \rightarrow ~~~   & \qquad  {y_i}^0 ~ =          & f \tiny ~ ( \tiny ~ {\mathbf{x}_1}^0 \tiny ~ ) \\
            ~                 & \qquad {\mathbf{y}_i}^0 ~ =   & \mathbf{f} \tiny ~ ( \tiny ~ {\mathbf{x}_1}^0 \tiny ~ ) \\
            ~                 & \qquad {s_i}^0 ~ =            & ~~ F \tiny ~ ( \tiny ~     {y_i}^0, \mathbf{y}^0 \tiny ~ )
        \end{alignat}
    \end{minipage}
\end{lrbox}
\begin{longtable}{p{0.5\textwidth}p{0.5\textwidth}}
    Objective - fitness evaluation for the first population: objective values and fitness indices, $ {y_i}^0 $ and $ {s_i}^0 $, for the first generation; & \usebox{\try}
\end{longtable}

\end{document}

enter image description here

I want the table to look like this second image (obviously I was able to make it in with LaTeX, I just edited the first screenshot with PhotoShop):

enter image description here

Don't care about the usage of the box and minipage objects, it is just to allow the usage of the \alignat into the long table: I already found out that the trouble doesn't depend on these items. I tried to directly insert the equation into the table using the \aligned environment and the situation is exactly the same. I also tried out sizing commands such as \strut and \setlength, again without any result.

I need to use the \longtable command, as this table will be part of a longer table I have to separate in two pages.

Do you have any idea to solve this problem? I really don't know how to cope with it.

1
  • Manually, you could \raisebox{-.73\baselineskip}{\usebox{\try}} Apr 19, 2016 at 16:25

2 Answers 2

1

I'm not sure what \tiny~ is supposed to do, except for issuing several warnings.

You want to use the [t] option to minipage, but correct the inserted vertical spaces

\documentclass[11pt, a4paper, twoside, openright, titlepage]{book}
\usepackage[english]{babel}
\usepackage{amsmath,amssymb}
\usepackage{calc}
\usepackage{ltxtable}

\newsavebox{\try}

\begin{document}

\begin{lrbox}{\try}
\begin{minipage}[t]{0.5\textwidth-\tabcolsep}
\vspace{-\baselineskip}
\vspace{-\abovedisplayskip}
\begin{alignat}{2}
\rightarrow && \qquad {y_i}^0          &= f({\mathbf{x}_1}^0) \\
            && \qquad {\mathbf{y}_i}^0 &= \mathbf{f}({\mathbf{x}_1}^0) \\
            && \qquad {s_i}^0          &= F({y_i}^0, \mathbf{y}^0)
\end{alignat}
\end{minipage}
\end{lrbox}
\begin{longtable}{
  @{}
  p{0.5\textwidth-\tabcolsep}
  p{0.5\textwidth-\tabcolsep}
  @{}
}
Objective - fitness evaluation for the first population: 
objective values and fitness indices, ${y_i}^0$ and ${s_i}^0$, 
for the first generation; & \usebox\try
\end{longtable}

\end{document}

Note that the column widths must be reduced to cope with the intercolumn space. The alignment is obtained by using the proper markup: aligned and `aligned

enter image description here

0

Since the OP indicated my comment solved the problem, I repost it as an answer. Here, I manually apply a \raisebox to the \usebox{try}, in order to align baselines with the top row.

\documentclass[11pt, a4paper, twoside, openright, titlepage]{book}
\usepackage[english]{babel}
\usepackage{amsmath,amssymb}
\usepackage{ltxtable}
\begin{document}
\newsavebox\try
\begin{lrbox}{\try}
    \begin{minipage}{0.5\textwidth}
        \begin{alignat}{3}
            \rightarrow ~~~   & \qquad  {y_i}^0 ~ =          & 
            f \tiny ~ ( \tiny ~ {\mathbf{x}_1}^0 \tiny ~ ) \\
            ~                 & \qquad {\mathbf{y}_i}^0 ~ =   & 
            \mathbf{f} \tiny ~ ( \tiny ~ {\mathbf{x}_1}^0 \tiny ~ ) \\
            ~                 & \qquad {s_i}^0 ~ =            & 
            ~~ F \tiny ~ ( \tiny ~     {y_i}^0, \mathbf{y}^0 \tiny ~ )
        \end{alignat}
    \end{minipage}
\end{lrbox}
\begin{longtable}{p{0.5\textwidth}p{0.5\textwidth}}
    Objective - fitness evaluation for the first population: objective values 
    and fitness indices, $ {y_i}^0 $ and $ {s_i}^0 $, for the first generation; & 
    \raisebox{-.73\baselineskip}{\usebox{\try}}
\end{longtable}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .