[texhax] minipage conditional

Vafa Khalighi vafa018 at gmail.com
Tue Jun 21 09:49:42 CEST 2011


The minipage environment accepts b, t, and few others as the position of the
minipage. I want \test macro return "true" if it is used inside minipage
with b position and otherwise return "false". I do not know if there is a
better way but this is what I did:


\documentclass{article}
\makeatletter
\newif\if at test
\long\def\@iiiparbox#1#2[#3]#4#5{%
  \leavevmode
  \@pboxswfalse
  \setlength\@tempdima{#4}%
  \@begin at tempboxa\vbox{\hsize\@tempdima\@parboxrestore#5\@@par}%
    \ifx\relax#2\else
      \setlength\@tempdimb{#2}%
      \edef\@parboxto{to\the\@tempdimb}%
    \fi
    \if#1b\@testtrue\vbox%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% this is where
I made \if at test true
    \else\if #1t\vtop
    \else\ifmmode\vcenter
    \else\@pboxswtrue $\vcenter
    \fi\fi\fi
    \@parboxto{\let\hss\vss\let\unhbox\unvbox
       \csname bm@#3\endcsname}%
    \if at pboxsw \m at th$\fi
  \@end at tempboxa}
\def\test{\if at test true\else false\fi}
\makeatother
\begin{document}
\begin{minipage}[b]{0.5\textwidth}
\test
\end{minipage}
\end{document}

But it returns "false". Why is this? how can I fix it? Is it a better way
for doing what I want to do?

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texhax/attachments/20110621/0d0e1771/attachment.html>


More information about the texhax mailing list