texmacs-dev
[Top][All Lists]
Advanced

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

Re: [Texmacs-dev] Concat surround, and line wrapping macro expansions


From: David Allouche
Subject: Re: [Texmacs-dev] Concat surround, and line wrapping macro expansions
Date: Mon, 21 Oct 2002 01:55:51 +0200
User-agent: Mutt/1.4i

On Sun, Oct 20, 2002 at 10:28:42PM +0200, Felix Breuer wrote:
> Hello again.
> 
> Let me generalize my question. If I have
> 
> 
> <assign|myenv|<macro|x|<argument|x>>>
> 
> 
> x is correctly wrapped at the end of a line. However, as soon as I add
> anything to the second argument of the macro such as
> 
> 
> <assign|myenv|<macro|x|Hello <argument|x>>>
> 
> 
> x is not wrapped anymore. This can be circumvented using surround, as in
> 
> 
> <assign|myenv|<macro|x|<surround|Hello ||<argument|x>>>>
> 
> 
> so that line wrapping works again. But: If my macro has two arguments,
> as in
> 
> <assign|myenv|<macro|x|y|<argument|x> text in between <argument|y>>>
> 
> 
> lines are not wrapped. So if I want my environment to put something
> between its two arguments *and* if I want "<x> text in between <y>" to
> be displayed in one correctly wrapped paragraph... how do I do it?

There are very subtle problems in the typesetter with that kind of things.

With "Tools->Selections->Export->Scheme" you will be able to see the
internal structure of any document fragment. Actually, the internal
structure is not Scheme, but that scheme format is the closest you can
easily get.

    <assign|myenv|<macro|x|<argument|x>>>
Gives
    (assign "myenv" (macro "x" (argument "x")))
which is all very obvious. But
    <assign|myenv|<macro|x|Hello <argument|x>>>
gives
    (assign "myenv" (macro "x" (concat "Hello " (argument "x"))))
The extra concat is needed to put several elements (here, the string
"Hello " and the argument) in a single parameter of the macro element.

Maybe that extra concat is what is causing the problem, and that using
a nested surround somehow puts the typesetter back to a correct path
of execution.

Anyhow, you can achieve what you want to do simply by with:

    <assign|wrap|<macro|x|y|<surround|||<arg|x>
      text in between <arg|y>>>>

:-) Thanks for pointing that trick with SURROUND, by the way.

-- 
David Allouche         | GNU TeXmacs -- Writing is a pleasure
Free software engineer |    http://www.texmacs.org
   http://ddaa.net     |    http://alqua.com/tmresources
   address@hidden  |    address@hidden
TeXmacs is NOT a LaTeX front-end and is unrelated to emacs.





reply via email to

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