I have written a few environments for formatting use cases. For some reason I am having strange alignment issues in my longtable. I think that there is some invisible placeholder in there messing it all up, but after several hours, and after removing all unnecessary spaces, I can't find it.
Here are my environments:
\newenvironment{ucflowofevents}{%
\newcommand{\event}[1]{\item{##1}}%
\begin{enumerate}
}{%
\end{enumerate}
}
\newenvironment{ucentryconditions}{%
\newcommand{\cond}[1]{\item{##1}}%
\begin{itemize}
}{%
\end{itemize}
}
\newenvironment{ucexitconditions}{%
\newcommand{\cond}[1]{\item{##1}}%
\begin{itemize}
}{%
\end{itemize}
}
\newenvironment{ucrequirements}{%
\newcommand{\req}[1]{\item{##1}}%
\begin{itemize}
}{%
\end{itemize}
}
\newenvironment{pcusecase}[1]{%
\newcommand{\row}[3][\hline]{##2 & ##3 \\ ##1}
\newcolumntype{L}{>{\vspace{-1.0\baselineskip}\flushleft\arraybackslash}p{4cm}}%
\newcolumntype{R}{>{\vspace{-1.0\baselineskip}\raggedright\arraybackslash}b{10cm}}%
\newcommand{\giveninitactors}{REQUIRED!!!}%
\newcommand{\givenevents}{REQUIRED!!!}%
\newcommand{\givencommswith}{}%
\newcommand{\givenentries}{}%
\newcommand{\givenexits}{}%
\newcommand{\givenreqs}{}%
\newcommand{\initactors}[1]{\gdef\giveninitactors{##1}}%
\newcommand{\commswith}[1]{\gdef\givencommswith{##1}}%
\newcommand{\events}[1]{\gdef\givenevents{\begin{ucflowofevents}##1\end{ucflowofevents}}}%
\newcommand{\entries}[1]{\gdef\givenentries{\begin{ucentryconditions}##1\end{ucentryconditions}}}%
\newcommand{\exits}[1]{\gdef\givenexits{\begin{ucexitconditions}##1\end{ucexitconditions}}}%
\newcommand{\reqs}[1]{\gdef\givenreqs{\begin{ucrequirements}##1\end{ucrequirements}}}%
\let\givencommswith\empty%
\let\givenentries\empty%
\let\givenexits\empty%
\let\givenreqs\empty%
\centering%
\begin{longtable}{|LR|}\hline %
\row{Use Case:}{#1}
}{%
\row{Initiating Actors:}{\giveninitactors}%
\ifx\givencommswith\empty\else \row[]{Communicates With:}{\givencommswith} \fi %\hline %
\hline\row{Flow of Events:}{\givenevents} %
\ifx\empty\givenentries\else \row{Entry Conditions:}{\givenentries} \fi %
\ifx\empty\givenexits\else \row{Exit Conditions:}{\givenexits} \fi %
\ifx\empty\givenreqs\else \row{Quality Requirements:}{\givenreqs} \fi%
\end{longtable}%
}
The first four just set up lists for the flow of events, entry and exit conditions, and quality requirements. But pcusecase sets up the longtable.
Notice the \newcolumntype definitions:
\newcolumntype{L}{>{\vspace{-1.0\baselineskip}\flushleft\arraybackslash}p{4cm}}%
\newcolumntype{R}{>{\vspace{-1.0\baselineskip}\raggedright\arraybackslash}b{10cm}}%
What I really want is for them both to be top aligned, but I specified b for the right-hand (R) column because it exaggerates what happens. Here is my use case:
\begin{pcusecase}{TestUseCase}%
\initactors{Rider, Admin}%
\commswith{GPSService}%
\events{\item{Event 1}%
\item{Event 2}}%
\entries{\cond{Entry Condition 1}%
\cond{Entry Condition 2}}%
\exits{\cond{Exit Condition 1}%
\cond{Exit Condition 1}}%
\reqs{\req{Requirement 1}%
\req{Requirement 2}
\req{Requirement 3}}%
\end{pcusecase}
which gives this output:

Notice that for the first three rows, the right-hand cells are bottom-aligned like they should be, but for the remaining rows, the left cells are bottom-aligned and the right cells are top-aligned.
If I specify that left should be bottom-aligned, and the right top-aligned with
\newcolumntype{L}{>{\vspace{-1.0\baselineskip}\flushleft\arraybackslash}b{4cm}}%
\newcolumntype{R}{>{\vspace{-1.0\baselineskip}\raggedright\arraybackslash}p{10cm}}%
I get this:

The left is somehow top-aligned and the right-bottom aligned, sort of. The weirdest one, and probably the one that is going to clue somebody in, is when I specify that both should be bottom aligned and get this:

In all three versions, the alignment in the three upper-left cells didn't change. I've been staring for hours. I need some fresh eyes on this. Your help is greatly appreciated...



articleclass or do we need to try another one? – egreg May 02 '15 at 08:06