Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a table with two columns and one row. The first one is long and determines the overall height of the table (if need be it can be fixed to \textheight). In the second column I have two images. I would like one of them to be aligned to the top of the first column and the other to the second - an effect similar to a \vfill on a normal page - see example below.

The \vfill doesn't seem to work, presumably because the table's height is not defined when that column is set?

I have tried:

  1. Calculating the remaining space on the page using the \measurepage macro from this question and inserting this using \vspace - unfortunately this seems to produce lengths much greater than the real available space

  2. putting in a 0 width (invisible) rule of \textheight to fix the column height and then using \raisebox to move the column contents back up. (this fails miserably)

Is there another way of

Here is a minimal example

%% LyX 2.0.3 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[10pt,a4paper,oneside,english,oldfontcommands,a4paper]{memoir}
\usepackage{fontspec}
\setcounter{secnumdepth}{2}
\setcounter{tocdepth}{2}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\pdfpageheight\paperheight
\pdfpagewidth\paperwidth


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
%packages
\usepackage{calc}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{colortbl}
\usepackage{multirow}
\usepackage{lipsum}



\newcommand\measurepage{\dimexpr\pagegoal-\pagetotal-\baselineskip\relax}

\makeatother

\usepackage{babel}
\begin{document}
\renewcommand{\tabularxcolumn}[1]{m{#1}}


\noindent\begin{tabularx}{\linewidth}{@{}X|p{0.2\linewidth}@{}}

\rule{\TX@col@width}{\textheight-\baselineskip} 

&
\begingroup\rule{\linewidth}{0.15\textheight} \newline Some text \vfill \rule{\linewidth}{0.15\textheight}\endgroup \tabularnewline  


 \end{tabularx} 

\end{document}

Edit:

Here is a picture showing what I am trying to acheive. Two column table, the left one determines the overall height. The two images on the right should be aligned with the top and bottom of the content of the left column. There will be some text between these images in the right column, of variable length.

So far I can get the images either bottom aligned or top aligned, but not one at the top and one at the bottom.

This is what I wantto acheive

share|improve this question
    
I don't have lyx installed (unable to compile). However I would try using the minipage environment. Then you can use \vspace* –  R. Schumacher Mar 26 '12 at 14:20
1  
It is a bit unclear what you want to achieve. Could you make a picture? (Measuring the page is certainly not the way to go). –  Ulrike Fischer Mar 26 '12 at 14:24
add comment

2 Answers 2

up vote 6 down vote accepted

It seems simpler to do this without a tabular environment and just use the minipage environment. Below I used the showframe package to display the location of the margins:

enter image description here

\documentclass{memoir}

\usepackage[demo]{graphicx}
\usepackage{showframe}

\newcommand{\DesiredHeight}{10.0cm}%
\begin{document}
\noindent
\begin{minipage}[b][\DesiredHeight]{0.8\linewidth}
\includegraphics[height=\DesiredHeight, width=0.8\textwidth]{leftImage}
\end{minipage}%
\begin{minipage}[b][\DesiredHeight]{0.2\linewidth}\noindent
\includegraphics[width=\linewidth]{topImage}
\par\noindent
Some text and some more text.
\vfill
\includegraphics[width=\linewidth]{bottomImage}
\end{minipage}%
\end{document}
share|improve this answer
    
Excellent, thank you. Works perfectly. You don't know how many hours I spent trying to make this work... –  user8786 Mar 26 '12 at 19:47
add comment
\documentclass{memoir}
\usepackage{calc}
\usepackage{tabularx}
\renewcommand{\tabularxcolumn}[1]{m{#1}}

\begin{document}
\noindent
\begin{tabularx}{\linewidth}{@{} X | p{0.2\linewidth} @{} }
\rule{\linewidth}{\textheight-\baselineskip} 
&\vspace*{-3pt}%%%%%
\parbox[s][\textheight-\baselineskip]{\linewidth}{%
\rule{\linewidth}{0.15\textheight} \\
Some text \par\vfill 
\rule{\linewidth}{0.15\textheight}} \tabularnewline  
\end{tabularx} 

\end{document}

enter image description here

share|improve this answer
    
Hi Herbert, This is great. There is a small difference in alignment between the small and big rules though, presumably due to "padding" inside the parbox? Is there a variable for that space that I can include into the calculation of the parbox dimensions? –  user8786 Mar 26 '12 at 19:38
    
@user8786: see my edit (%%%%). It is a hack, because I have no real time for a closer look. –  Herbert Mar 26 '12 at 19:57
    
Thanks. I worked out that putting the contents of the first column in a parbox as well sorts it so they have identical spacing. –  user8786 Mar 26 '12 at 20:34
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.