[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [help-texinfo] Determine if an argument was supplied to a macro

From: Pantxo Diribarne
Subject: Re: [help-texinfo] Determine if an argument was supplied to a macro
Date: Tue, 24 Sep 2019 22:14:21 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

Le 24/09/2019 à 20:41, Gavin Smith a écrit :
On Tue, Sep 24, 2019 at 4:41 PM Pantxo Diribarne
<address@hidden> wrote:
Now how would I go if I want to display the third argument in case it's supplied and the first in case arg3 is empty?
It's not very easy. The best I could come up was the following:

@c use arg1 if present, otherwise use arg2
@macro choosearg{arg1, arg2}
@set dummyflag
@inlineifclear{dummyflag\arg1\, \arg1\}
@inlineifset{dummyflag\arg1\, \arg2\}
@end macro

I tested that this works with spaces in the arguments, but this
doesn't work if arg1 has any @-commands in it: this could be avoided
if the node names don't have @-commands in them.

Thank you very much for your fast answer, there won't be any @-command in the arguments so your solution should work in principle.

Unfortunately, in the mean time I found out that I was unable to generate valid tex output with this macro. The @myref macro is used within a @deftypefn block environment and, while running texi2dvi, I get an error similar to the one mentioned in  [1], something like "Paragraph ended before @deftypefn was complete".

So this approach for partly aliasing the @*ref macros doesn't look like the right one. I guess I'll need to preprocess my texi strings based on the output format. Or is there another way?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]