Macro introduces \par in Table of Contents

2020-10-03 Thread Christopher Dimech


I have written the macro uSubSec

However I have found that a \par is introduced in the Table of Contents
when the title continues on the next line. How can this problem be solved?

Example:

@uSubSec{@value{SecLb}, Probabilistic Characterisation of
Microseismicity}

@macro uSubSec{label, titl}

  @set lb \label\
  @ifclear USubSec--No--Label
@unnumberedsubsec @value{lb} @ \titl\
  @end ifclear

  @ifset USubSec--No--Label
@unnumberedsubsec \titl\
  @end ifset

@end macro



Re: Macro introduces \par in Table of Contents

2020-10-03 Thread Gavin Smith
On Sat, Oct 3, 2020 at 9:20 AM Christopher Dimech  wrote:
>
>
> I have written the macro uSubSec
>
> However I have found that a \par is introduced in the Table of Contents
> when the title continues on the next line. How can this problem be solved?
>
> Example:
>
> @uSubSec{@value{SecLb}, Probabilistic Characterisation of
> Microseismicity}
>
> @macro uSubSec{label, titl}
>
>   @set lb \label\
>   @ifclear USubSec--No--Label
> @unnumberedsubsec @value{lb} @ \titl\
>   @end ifclear
>
>   @ifset USubSec--No--Label
> @unnumberedsubsec \titl\
>   @end ifset
>
> @end macro

Your input does not work with texi2any either, although in that case
the part of the argument on the next line is not even included in the
argument to @unnumberedsubsec. Hence, I do not think that this should
be made to work with TeX.

The best solution I've come up with is to use DEL as a comment
character. (I've never seen a use for this before!)

\input texinfo

@macro uSubSec{label, titl}

  @set lb \label\
@unnumberedsubsec @value{lb} @ \titl\

@end macro


@uSubSec{@value{SecLb}, Probabilistic ^?
Characterisation of Microseismicity}


where ^? is the DEL character (byte value 0x7f). This appears to work
perfectly with both texinfo.tex and texi2any.

I found that starting a new line, like

@uSubSec{@value{SecLb},
Probabilistic Characterisation of Microseismicity}

worked with texi2any, but not with TeX.

As usual with macro handling in Texinfo, this is not easy to fix, and
any fix risks breaking something else. There is an @xeatspaces macro
being used around macro arguments that is not being expanded until
quite late on, which might be better expanded earlier with a given
value of active newline, but it would be very complicated if not
impossible to expand this earlier without fully expanding the macro
arguments at the same time (probably some complex arrangement of
\expandafter's which would differ depending on the number of macro
arguments, or repeatedly reading the argument text as a macro argument
and moving expanded arguments one by one to the end). Even if it's
possible it's probably better not to try as it would be error-prone
and hard to understand after the fact.

Another option was changing the definition of active newline away from
@par to a space or an empty string, but this broke using a macro
inside an environment like @example.



Re: Macro introduces \par in Table of Contents

2020-10-03 Thread Gavin Smith
I'm going to try putting an example with a DEL character in an email
to see if it gets through:


@uSubSec{@value{SecLb}, Probabilistic
Characterisation of Microseismicity}



Re: Macro introduces \par in Table of Contents

2020-10-03 Thread Christopher Dimech


With the following code it worked

@uSubSec{@value{SecLb}, Probabilistic Characterisation of@
Microseismicity}

But you are saying that it code breaks using a macro
inside an environment like @example.

However, relating to sections and subsections, @uSubSec
won't be called in side an example.

Can one do multiline titles using @unnumberedsec?

Does the multiline thing fail when using macros, or is the problem
only related to defining sections?



> Sent: Saturday, October 03, 2020 at 12:18 PM
> From: "Gavin Smith" 
> To: "Christopher Dimech" 
> Cc: "help-texinfo gnu" 
> Subject: Re: Macro introduces \par in Table of Contents
>
> On Sat, Oct 3, 2020 at 9:20 AM Christopher Dimech  wrote:
> >
> >
> > I have written the macro uSubSec
> >
> > However I have found that a \par is introduced in the Table of Contents
> > when the title continues on the next line. How can this problem be solved?
> >
> > Example:
> >
> > @uSubSec{@value{SecLb}, Probabilistic Characterisation of
> > Microseismicity}
> >
> > @macro uSubSec{label, titl}
> >
> >   @set lb \label\
> >   @ifclear USubSec--No--Label
> > @unnumberedsubsec @value{lb} @ \titl\
> >   @end ifclear
> >
> >   @ifset USubSec--No--Label
> > @unnumberedsubsec \titl\
> >   @end ifset
> >
> > @end macro
>
> Your input does not work with texi2any either, although in that case
> the part of the argument on the next line is not even included in the
> argument to @unnumberedsubsec. Hence, I do not think that this should
> be made to work with TeX.
>
> The best solution I've come up with is to use DEL as a comment
> character. (I've never seen a use for this before!)
>
> \input texinfo
>
> @macro uSubSec{label, titl}
>
>   @set lb \label\
> @unnumberedsubsec @value{lb} @ \titl\
>
> @end macro
>
>
> @uSubSec{@value{SecLb}, Probabilistic ^?
> Characterisation of Microseismicity}
>
>
> where ^? is the DEL character (byte value 0x7f). This appears to work
> perfectly with both texinfo.tex and texi2any.
>
> I found that starting a new line, like
>
> @uSubSec{@value{SecLb},
> Probabilistic Characterisation of Microseismicity}
>
> worked with texi2any, but not with TeX.
>
> As usual with macro handling in Texinfo, this is not easy to fix, and
> any fix risks breaking something else. There is an @xeatspaces macro
> being used around macro arguments that is not being expanded until
> quite late on, which might be better expanded earlier with a given
> value of active newline, but it would be very complicated if not
> impossible to expand this earlier without fully expanding the macro
> arguments at the same time (probably some complex arrangement of
> \expandafter's which would differ depending on the number of macro
> arguments, or repeatedly reading the argument text as a macro argument
> and moving expanded arguments one by one to the end). Even if it's
> possible it's probably better not to try as it would be error-prone
> and hard to understand after the fact.
>
> Another option was changing the definition of active newline away from
> @par to a space or an empty string, but this broke using a macro
> inside an environment like @example.
>



Re: Macro introduces \par in Table of Contents

2020-10-03 Thread Christopher Dimech
I have also implemented the following macro

@macro InlRmk{a}
@ifset Margi
@b{\a\}
@end ifset
@end macro

And I was able to call the macro with multiline information, including
commas (no need to use @comma{}) and everything is being written

@InlRmk{@bullet{} [1] This Work - Waveforms from Sicilian Stations [2]
Hidden Signals - Revealed by Hilbert, Stockwell & Wavelet Tfm [3]
Improve Subsurface Estimn - Irregular Distribution of Earthqk, Low
Tectonic Movements.}


> Sent: Saturday, October 03, 2020 at 12:18 PM
> From: "Gavin Smith" 
> To: "Christopher Dimech" 
> Cc: "help-texinfo gnu" 
> Subject: Re: Macro introduces \par in Table of Contents
>
> On Sat, Oct 3, 2020 at 9:20 AM Christopher Dimech  wrote:
> >
> >
> > I have written the macro uSubSec
> >
> > However I have found that a \par is introduced in the Table of Contents
> > when the title continues on the next line. How can this problem be solved?
> >
> > Example:
> >
> > @uSubSec{@value{SecLb}, Probabilistic Characterisation of
> > Microseismicity}
> >
> > @macro uSubSec{label, titl}
> >
> >   @set lb \label\
> >   @ifclear USubSec--No--Label
> > @unnumberedsubsec @value{lb} @ \titl\
> >   @end ifclear
> >
> >   @ifset USubSec--No--Label
> > @unnumberedsubsec \titl\
> >   @end ifset
> >
> > @end macro
>
> Your input does not work with texi2any either, although in that case
> the part of the argument on the next line is not even included in the
> argument to @unnumberedsubsec. Hence, I do not think that this should
> be made to work with TeX.
>
> The best solution I've come up with is to use DEL as a comment
> character. (I've never seen a use for this before!)
>
> \input texinfo
>
> @macro uSubSec{label, titl}
>
>   @set lb \label\
> @unnumberedsubsec @value{lb} @ \titl\
>
> @end macro
>
>
> @uSubSec{@value{SecLb}, Probabilistic ^?
> Characterisation of Microseismicity}
>
>
> where ^? is the DEL character (byte value 0x7f). This appears to work
> perfectly with both texinfo.tex and texi2any.
>
> I found that starting a new line, like
>
> @uSubSec{@value{SecLb},
> Probabilistic Characterisation of Microseismicity}
>
> worked with texi2any, but not with TeX.
>
> As usual with macro handling in Texinfo, this is not easy to fix, and
> any fix risks breaking something else. There is an @xeatspaces macro
> being used around macro arguments that is not being expanded until
> quite late on, which might be better expanded earlier with a given
> value of active newline, but it would be very complicated if not
> impossible to expand this earlier without fully expanding the macro
> arguments at the same time (probably some complex arrangement of
> \expandafter's which would differ depending on the number of macro
> arguments, or repeatedly reading the argument text as a macro argument
> and moving expanded arguments one by one to the end). Even if it's
> possible it's probably better not to try as it would be error-prone
> and hard to understand after the fact.
>
> Another option was changing the definition of active newline away from
> @par to a space or an empty string, but this broke using a macro
> inside an environment like @example.
>



Re: Macro introduces \par in Table of Contents

2020-10-03 Thread Christopher Dimech
I have now tried

@uSubSec{@value{SecLb}, Probabilistic Characterisation of^?
Microseismicity}

But this is giving me the following output in my pdf file.
As seen, the ^? is being printed

B Probabilistic Characterisation of^?
Microseismicity

And the Table of Contents is showing

B Probabilistic Characterisation of^?\par Microseismicity . . . . . . . . 5




> Sent: Saturday, October 03, 2020 at 12:18 PM
> From: "Gavin Smith" 
> To: "Christopher Dimech" 
> Cc: "help-texinfo gnu" 
> Subject: Re: Macro introduces \par in Table of Contents
>
> On Sat, Oct 3, 2020 at 9:20 AM Christopher Dimech  wrote:
> >
> >
> > I have written the macro uSubSec
> >
> > However I have found that a \par is introduced in the Table of Contents
> > when the title continues on the next line. How can this problem be solved?
> >
> > Example:
> >
> > @uSubSec{@value{SecLb}, Probabilistic Characterisation of
> > Microseismicity}
> >
> > @macro uSubSec{label, titl}
> >
> >   @set lb \label\
> >   @ifclear USubSec--No--Label
> > @unnumberedsubsec @value{lb} @ \titl\
> >   @end ifclear
> >
> >   @ifset USubSec--No--Label
> > @unnumberedsubsec \titl\
> >   @end ifset
> >
> > @end macro
>
> Your input does not work with texi2any either, although in that case
> the part of the argument on the next line is not even included in the
> argument to @unnumberedsubsec. Hence, I do not think that this should
> be made to work with TeX.
>
> The best solution I've come up with is to use DEL as a comment
> character. (I've never seen a use for this before!)
>
> \input texinfo
>
> @macro uSubSec{label, titl}
>
>   @set lb \label\
> @unnumberedsubsec @value{lb} @ \titl\
>
> @end macro
>
>
> @uSubSec{@value{SecLb}, Probabilistic ^?
> Characterisation of Microseismicity}
>
>
> where ^? is the DEL character (byte value 0x7f). This appears to work
> perfectly with both texinfo.tex and texi2any.
>
> I found that starting a new line, like
>
> @uSubSec{@value{SecLb},
> Probabilistic Characterisation of Microseismicity}
>
> worked with texi2any, but not with TeX.
>
> As usual with macro handling in Texinfo, this is not easy to fix, and
> any fix risks breaking something else. There is an @xeatspaces macro
> being used around macro arguments that is not being expanded until
> quite late on, which might be better expanded earlier with a given
> value of active newline, but it would be very complicated if not
> impossible to expand this earlier without fully expanding the macro
> arguments at the same time (probably some complex arrangement of
> \expandafter's which would differ depending on the number of macro
> arguments, or repeatedly reading the argument text as a macro argument
> and moving expanded arguments one by one to the end). Even if it's
> possible it's probably better not to try as it would be error-prone
> and hard to understand after the fact.
>
> Another option was changing the definition of active newline away from
> @par to a space or an empty string, but this broke using a macro
> inside an environment like @example.
>



Re: Macro introduces \par in Table of Contents

2020-10-03 Thread Gavin Smith
On Sat, Oct 3, 2020 at 3:28 PM Christopher Dimech  wrote:
>
> I have now tried
>
> @uSubSec{@value{SecLb}, Probabilistic Characterisation of^?
> Microseismicity}
>
> But this is giving me the following output in my pdf file.
> As seen, the ^? is being printed

It is not the two characters "^?"; it is just one character. I am
sending a file attachment.


snippet
Description: Binary data


Re: Macro introduces \par in Table of Contents

2020-10-03 Thread Gavin Smith
On Sat, Oct 3, 2020 at 2:32 PM Christopher Dimech  wrote:
>
>
> With the following code it worked
>
> @uSubSec{@value{SecLb}, Probabilistic Characterisation of@
> Microseismicity}

Yes, that would look like it would work, as there is a single letter
control sequence "@NL" where NL is a newline character (see info node
"(texinfo)Multiple Spaces").

> But you are saying that it code breaks using a macro
> inside an environment like @example.
>
> However, relating to sections and subsections, @uSubSec
> won't be called in side an example.

Yes, but other macros may be.

> Can one do multiline titles using @unnumberedsec?

This is not supported and if it works, it works by accident.

> Does the multiline thing fail when using macros, or is the problem
> only related to defining sections?

It is because the @unnumberedsec command takes its argument on a single line.



Re: Macro introduces \par in Table of Contents

2020-10-03 Thread Christopher Dimech
Have done some more tests and the \par problem extends also to multiline
titles for @chapter, @section, @subsection, and @subsubsec.

For users, using @ at the end of each line is acceptable. It also gets
the correct title alignments.  Using  DEL character is not a good strategy
for users.

@chapter{Amplitude Asymmetry in the Empirical Green Function Amplitude@
Asymmetry}

@section{Strong amplitude asymmetries between the Retarded Causal Branch@
and the Advanced Anti-Causal contribution to the Coherence Function}

Allowing Multiline titles would be a good improvement to Texinfo, especially
for users to write on complicated topics, books, etc.

One possible solution could include the addition of a Title Construction
Function one can call, which would allow multiline titles to be properly
passed to sections and subsections, including the unnumbered versions.

I have previously constructed macros with several arguments. My experience has
been that parameter values are being passed correctly even if they continue for
several  lines.  Might need to write some small examples and send them, to see
that works and what does not.

Regards
Christopher


> Sent: Saturday, October 03, 2020 at 6:02 PM
> From: "Gavin Smith" 
> To: "Christopher Dimech" 
> Cc: "help-texinfo gnu" 
> Subject: Re: Macro introduces \par in Table of Contents
>
> On Sat, Oct 3, 2020 at 2:32 PM Christopher Dimech  wrote:
> >
> >
> > With the following code it worked
> >
> > @uSubSec{@value{SecLb}, Probabilistic Characterisation of@
> > Microseismicity}
>
> Yes, that would look like it would work, as there is a single letter
> control sequence "@NL" where NL is a newline character (see info node
> "(texinfo)Multiple Spaces").
>
> > But you are saying that it code breaks using a macro
> > inside an environment like @example.
> >
> > However, relating to sections and subsections, @uSubSec
> > won't be called in side an example.
>
> Yes, but other macros may be.
>
> > Can one do multiline titles using @unnumberedsec?
>
> This is not supported and if it works, it works by accident.
>
> > Does the multiline thing fail when using macros, or is the problem
> > only related to defining sections?
>
> It is because the @unnumberedsec command takes its argument on a single line.
>