Skip to Content.
Sympa Menu

texmacs-users - Re: How to hide an environnement?

Subject: mailing-list for TeXmacs Users

List archive

Re: How to hide an environnement?


Chronological Thread 
  • From: David Allouche <address@hidden>
  • To: Alain Herreman <address@hidden>
  • Cc: address@hidden
  • Subject: Re: How to hide an environnement?
  • Date: Wed, 13 Nov 2002 12:41:01 +0100

On Tue, Nov 12, 2002 at 08:00:19PM +0100, Alain Herreman wrote:
>
> I have defined a variable "answer-visible?" which has the value "true" or
> "false" and in a ts file :
>
> <assign|answer|<macro|body|<if|<answer-visible?>|<surround|<vspace*|1fn><for
> mat no first indentation>|<htab|5mn>|<arg|body>>>>>
>
> But, with answer-visible? true, surround doesn't work : I have one long line
> without any return.
>
> Do you have any explanation or solution?

That is one of the problem the typesetter has when mixing inline and
block structure. Specificially, <if> is an inline structure, so
placing a surround (block structure) within an <if> messes things up.

The solution is to think it the other way:

(assign "answer" (macro "body"
(expand (if (apply "answer-visible?")
(macro "x"
(surround
(concat (vspace* "1fn")
(format "no first indentation"))
(htab "5mn")
(arg "x")))
(macro "x" ""))
(arg "body"))))


(first select Tools->Selections->Import->Scheme, then copy the text
above, then paste in TeXmacs)

Yet that is only a partial solution, since hidden answers still
produce an empty line. But you can also hack a bit to hide the line.

(assign "answer" (macro "body"
(expand (if (apply "answer-visible?")
(macro "x"
(surround
(concat (vspace* "1fn")
(format "no first indentation"))
(htab "5mn")
(arg "x")))
(macro "x"
(with "interparagraph space" "-1fn"
"interline space" "0"
"line stretch" "0"
"")))
(arg "body"))))

Not bad... To have it even better, it should be made impossible to
access to said line while it is hidden... That would require some
modification of the core. Probably to be discussed on texmacs-dev
sometime soon (I had met that need in a completely different
application too).

--
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.




Archive powered by MHonArc 2.6.19.

Top of Page