[texhax] minipage conditional
Heiko Oberdiek
heiko.oberdiek at googlemail.com
Tue Jun 21 12:00:22 CEST 2011
On Tue, Jun 21, 2011 at 05:49:42PM +1000, Vafa Khalighi wrote:
> 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".
\documentclass{article}
\makeatletter
\newif\if at test
\newcommand*{\org at iiiminipage}{}
\let\org at iiiminipage\@iiiminipage
\def\@iiiminipage#1{%
\in@{b}{#1}%
\ifin@
\@testtrue
\else
\@testfalse
\fi
\org at iiiminipage{#1}%
}
\def\test{\if at test true\else false\fi}
\makeatother
\begin{document}
\begin{minipage}[b]{.5\linewidth}
\test
\end{minipage}
\begin{minipage}{.5\linewidth}
\test
\end{minipage}
\end{document}
Yours sincerely
Heiko Oberdiek
More information about the texhax
mailing list