\long\def\@makecaption#1#2{%
\def\temptyA{#2}%
\ifx\temptyA\empty
....
\else
.....
\endif}
However, even if I use \caption{} (value of caption is passed by #2),
the ifx command is never true. Why?
Thanks for the answer,
Marko.
I don't believe you, so you better give some more code. You are
probably goofing up with bracing levels (braced delimited arguments
get their braces stripped on macro calls, so you have to add them
again at each level).
--
David Kastrup, Kriemhildstr. 15, 44793 Bochum
UKTUG FAQ: <URL:http://www.tex.ac.uk/cgi-bin/texfaq2html>
Thanks
> The problem seems to be in the fact that parameter from \caption is
> passed to
> \makecaption as {\ignorespaces #1} (at least, maybe there is even more
> passing on of parameter). So even if \caption{} is specified, the
> actual parameter to makecaption is something like {\ignorespaces
> {ignorespaces {{}}}}. How can I get rid of all those brackets and
> \ignorespaces , get simply {}and compare that to \empty?
Too complicated. Just compare to a macro set to whatever will result
from an empty argument instead of comparing to \empty.
>Marko Pinteric <marko.p...@uni-mb.si> writes:
>
>
>
>>The problem seems to be in the fact that parameter from \caption is
>>passed to
>>\makecaption as {\ignorespaces #1} (at least, maybe there is even more
>>passing on of parameter). So even if \caption{} is specified, the
>>actual parameter to makecaption is something like {\ignorespaces
>>{ignorespaces {{}}}}. How can I get rid of all those brackets and
>>\ignorespaces , get simply {}and compare that to \empty?
>>
>>
>
>Too complicated. Just compare to a macro set to whatever will result
>from an empty argument instead of comparing to \empty.
>
>
>
How can I know what is "whatever will result from an empty argument".
Is it possible to make
LaTeX to display that precisely?
Thanks, Marko.
>Marko Pinteric <marko.p...@uni-mb.si> writes:
>
>
>
>>The problem seems to be in the fact that parameter from \caption is
>>passed to
>>\makecaption as {\ignorespaces #1} (at least, maybe there is even more
>>passing on of parameter). So even if \caption{} is specified, the
>>actual parameter to makecaption is something like {\ignorespaces
>>{ignorespaces {{}}}}. How can I get rid of all those brackets and
>>\ignorespaces , get simply {}and compare that to \empty?
>>
>>
>
>Too complicated. Just compare to a macro set to whatever will result
>from an empty argument instead of comparing to \empty.
>
>
>
>Marko Pinteric <marko.p...@uni-mb.si> writes:
>
>
>
>>The problem seems to be in the fact that parameter from \caption is
>>passed to
>>\makecaption as {\ignorespaces #1} (at least, maybe there is even more
>>passing on of parameter). So even if \caption{} is specified, the
>>actual parameter to makecaption is something like {\ignorespaces
>>{ignorespaces {{}}}}. How can I get rid of all those brackets and
>>\ignorespaces , get simply {}and compare that to \empty?
>>
>>
>
>Too complicated. Just compare to a macro set to whatever will result
>from an empty argument instead of comparing to \empty.
>
>
>
What I found worked is in this code fragment:
\def\domorphism(#1,#2)|#3|/#4/<#5,#6>[#7`#8;#9]{%
\def\next{#4}%
\ifx\next\empty\relax
The \relax seems to be necessary for it to work properly. But I could
never find any procedure that invariably worked to find if an argument
was empty or expanded to \empty and this group couldn't either.
Replacing \def by \xdef usually worked until the day arrived that #4
was a matrix and then it bombed completely, choked on the ampersands.
> David Kastrup wrote:
>
> >>The problem seems to be in the fact that parameter from \caption is
> >>passed to
> >>\makecaption as {\ignorespaces #1} (at least, maybe there is even more
> >>passing on of parameter). So even if \caption{} is specified, the
> >>actual parameter to makecaption is something like {\ignorespaces
> >>{ignorespaces {{}}}}. How can I get rid of all those brackets and
> >>\ignorespaces , get simply {}and compare that to \empty?
> >>
> >
> >Too complicated. Just compare to a macro set to whatever will result
> >from an empty argument instead of comparing to \empty.
> >
> >
> How can I know what is "whatever will result from an empty
> argument". Is it possible to make
> LaTeX to display that precisely?
Well, you said it above, but if you explicitly want it, \show\macro
will show the definition of \macro.
Uh, what?
Anyhow, inside of alignments strange things can happen. Enclosing
the critical stuff that could contain & signs into
\ifnum`{=\z@\fi ... \ifnum`}=\z@\fi
should do the trick.
you can only do that by experimentation -- for example:
\def\temp{#1}%
\typeout{argument: \expandafter\strip@prefix\meaning\temp}%
(between \makeatletter..\makeatother), or by reading the code -- see
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=ltxcmds
> Is it possible to make
>LaTeX to display that precisely?
what do you mean? a latex macro that tells you what mangling gets
applied by the macros enclosing where it's called from? nah, silly.
--
Robin Fairbairns, Cambridge -- the man with no voice (_again_)
> Marko Pinteric <marko.p...@uni-mb.si> writes:
> >How can I know what is "whatever will result from an empty argument".
>
> you can only do that by experimentation -- for example:
>
> \def\temp{#1}%
> \typeout{argument: \expandafter\strip@prefix\meaning\temp}%
Oh, come on, the \strip@prefix trick is when you need to further
process the output in TeX's bowels. For just outputting them,
\toks@{#1}%
\typeout{argument: \the\toks@}%
will work fine.
> (between \makeatletter..\makeatother),
Ah yes, or write \toks0 instead of \toks@
> The problem seems to be in the fact that parameter from \caption is
> passed to
> \makecaption as {\ignorespaces #1} (at least, maybe there is even more
> passing on of parameter). So even if \caption{} is specified, the
> actual parameter to makecaption is something like {\ignorespaces
> {ignorespaces {{}}}}.
I ran into the same problem when working on "amsart" document class.
That is why the amsart definition of \@makecaption applies \@cdr:
\long\def\@makecaption#1#2{%
%
% Measure the contents of the caption. If \arg{2} is not
% empty, then we must add a period and an en-space before
% typesetting it. The \cs{@caption} macro adds an extra
% \cn{ignorespaces} at the beginning of \arg{2}, so in order
% to find out if the user-typed portion is empty we use
% \cs{@cdr} to pull off the \cn{ignorespaces}.
...
\@xp\@ifnotempty\@xp {\@cdr#2\@nil}%
{.\@captionfont\upshape\enspace#2}%
\@xp is an amsart shorthand for \expandafter and \@ifnotempty is a
special test that treats " " as equivalent to empty.
Because removing the first \ignorespaces seemed to be enough in
ordinary use, I never tried to handle more complicated possibilities.
PS. I don't recommend the amsart \@makecaption code as a good example
for anyone to follow :-) Some of the techniques I tried to apply were
ill-advised. But perhaps this little piece may be useful.
Thanks, Marko
Thanks, Marko