The first question has to do with vertical spacing. I want the both
minipages to be at the top of a given row even if they are of
different heights. By default the minipage with less material gets
centered. No matter how I mess around with p, t, m, and b in both
tabular and the minipages, I cannot get them both at the top unless I
do so explicitly as in the second example below.
The second question has to do with indenting of the first minipage
within the tabular environment. I am sure it has something to do with
defaults for tabular, but I could not get it to be at the margin
without explicit commands as in the second example below. There has
to a more elegant and automatic way to do this. What I want is the
alignment on the second page but using something more standard like
on the first page.
\documentclass[letterpaper]{article}
\usepackage{array}
\usepackage{lipsum}
\usepackage[lmargin=1in,rmargin=1in,tmargin=1in,bmargin=1in]{geometry}
\begin{document}
\lipsum[6-7] \bigskip
\begin{tabular}{>{\raggedright}p{6cm}l>{\raggedright}p{9cm}}
\begin{minipage}{6cm}
\lipsum[23] \par \bigskip
\lipsum[27]
\end{minipage} &
\begin{minipage}{9cm}
\lipsum[23-26]
\end{minipage}
\end{tabular}
\clearpage
\lipsum[6-7] \bigskip
\begin{tabular}{>{\raggedright\hspace{-21pt}}p{6cm}l>{\raggedright}
p{9cm}}
\raisebox{2.9cm}{
\begin{minipage}{6cm}
\lipsum[23] \par \bigskip
\lipsum[27]
\end{minipage} } &
\begin{minipage}{9cm}
\lipsum[23-26]
\end{minipage}
\end{tabular}
\end{document}
What latex does with the alignment argument to minipage is
set the "reference point" of the minipage to top, middle or
bottom. Then a tabular lines up these reference points. To
get the minipages aligned at their top, one must use [t] as
the first optional argument argument of the minipages (the
alignment argument to tabular is irrelevant.
> The second question has to do with indenting of the first minipage
> within the tabular environment. I am sure it has something to do with
> defaults for tabular, but I could not get it to be at the margin
> without explicit commands as in the second example below. There has
> to a more elegant and automatic way to do this. What I want is the
> alignment on the second page but using something more standard like
> on the first page.
A tabular is treated as a single large character. If it is the first
thing after a blank line, it starts a paragraph and is indented by
\parindent. So use \noindent\begin{tabular}.
Also, a tabular has default space added between columns,
and also before the first column and after tha last. So use
\noindent\nbegin{tabular}{@()...}
the @ is used to replace the intercolumn space with something.
If you give it an empty argument, that space is replaced with nothing.
>
> \documentclass[letterpaper]{article}
> \usepackage{array}
> \usepackage{lipsum}
> \usepackage[lmargin=1in,rmargin=1in,tmargin=1in,bmargin=1in]{geometry}
>
> \begin{document}
> \lipsum[6-7] \bigskip
> \begin{tabular}{>{\raggedright}p{6cm}l>{\raggedright}p{9cm}}
> \begin{minipage}{6cm}
Use
\noindent \begin{tabular}{@{}>{\raggedright}p{6cm}l>{\raggedright}
p{9cm}}
\begin{minipage}[t]{6cm}
> \lipsum[23] \par \bigskip
> \lipsum[27]
> \end{minipage} &
> \begin{minipage}{9cm}
Use
\begin{minipage}[t]{9cm}
> \lipsum[23-26]
> \end{minipage}
> \end{tabular}
I don't see why you are using both p{} columns and minipages.
surely one or the other is sufficient. p columns get top alignment
by default. In the above example, I get the same result with
\noindent\begin{tabular}{@{}ll}
Dan
As Dan said, you should not use minipage inside a tabular, for paragraph
column p, m and b are "minipages" already.
Besides your preamble contains 3 columns while you are using only 2 of
them...
> The second question has to do with indenting of the first minipage
> within the tabular environment. I am sure it has something to do with
> defaults for tabular, but I could not get it to be at the margin
> without explicit commands as in the second example below. There has
> to a more elegant and automatic way to do this. What I want is the
> alignment on the second page but using something more standard like
> on the first page.
As Dan said, a tabular is typeset in a \hbox and starts with
\leavevmode. Therefore \indent is automatically added (depending on
your settings).
Besides, indentation is cancelled inside p, m and b columns. If you
wish the paragraphs to be indented inside the cells, you must explicitly
set \parindent (or use ragged2e.sty - a very good package from
M Scharrer)
When using fixed width columns, you should ensure that the total width
does not exceed \linewidth: if the first column is p{6cm} the second
one should be p{\dimexpr\linewidth-6cm-4\tabcolsep} because the
glue \tabcolsep is added twice at every column edge. You may also
consider to set \tabcolsep to a different value...
I added \hline to control visually the alignments:
%-------------------------------------------------------------
\documentclass[letterpaper]{article}
\usepackage{array}
\usepackage{lipsum}
\usepackage[lmargin=1in,rmargin=1in,tmargin=1in,bmargin=1in]{geometry}
\begin{document}
\lipsum[6-7] \bigskip \edef\ParIndent{\parindent\the\parindent}
\noindent
\begin{tabular}{>{\raggedright\ParIndent}p{6cm}
>{\raggedright\ParIndent}p
{\dimexpr\linewidth-6cm-4\tabcolsep}} \hline
\lipsum[23] \par \bigskip
\lipsum[27]
&
\lipsum[23-26]
\tabularnewline \hline
\end{tabular}
\end{document}
% -------------------------------------------------------------
No! It is a very good package from Martin Schröder.
...Rolf
Yes ;-) I'm so sorry...
ragged2e is a very good package from Martin Schröder, usefull inside
narrow paragraph boxes, like narrow paragraph columns in tabulars...
Thanks for the correction !
\documentclass[letterpaper]{article}
\usepackage[lmargin=1in,rmargin=1in,tmargin=1in,bmargin=1in]{geometry}
\usepackage{tabularx,ragged2e}
\usepackage{lipsum}
\newcolumntype{R}[1]{>{\RaggedRight}p{#1}}
\renewcommand\tabularxcolumn[1]{R{#1}}
\begin{document}
\lipsum[6-7] \bigskip
\noindent
\begin{tabularx}{\linewidth}{@{} R{6cm} l X @{}}
\lipsum[23] \par
\lipsum[27]
& a column with less text but very wide &
\lipsum[23]
\end{tabularx}
\end{document}
Herbert
Any ideas?
I do not want indenting of paragraphs within tabular so the default is fine. But your solution still has the text in the first column indented because of the tabcolsep associated with the left hand side of the first column.
\documentclass[letterpaper]{article}
\usepackage{array}
\usepackage{lipsum}
\usepackage[lmargin=1in,rmargin=1in,tmargin=1in,bmargin=1in]{geometry}
\begin{document}
\setlength\tabcolsep{10pt}
\lipsum[6-7] \bigskip
\noindent \begin{tabular}{@{}>{\raggedright}p{6cm}!{}>{\raggedright}p{9cm}}
\lipsum[23] \par \bigskip
\lipsum[27]
&
\lipsum[23-25]
\end{tabular}
\end{document}
\documentclass[letterpaper]{article}
\usepackage{array}
\usepackage{lipsum}
\usepackage[lmargin=1in,rmargin=1in,tmargin=1in,bmargin=1in]{geometry}
\begin{document}
\setlength\tabcolsep{10pt}
\lipsum[6-7] \bigskip
\noindent
\begin{tabular}{@{}>{\raggedright}p{6cm}!{}
>{\raggedright}p{\dimexpr\linewidth-6cm-4\tabcolsep}}
\lipsum[23] \par \bigskip
\lipsum[27]
&
tabular adds the \tabcolsep glue between each column, array does the
same with \arraycolsep.
{ l @{} l } removes the glue between the two columns.
What you want is then
{@{} l @{\hskip.5\tabcolsep} l }
Thanks/ That is helpful.