mailing-list for TeXmacs Users

Text archives Help


Re: [TeXmacs] invisible parts


Chronological Thread 
  • From: David Allouche <address@hidden>
  • To: address@hidden
  • Subject: Re: [TeXmacs] invisible parts
  • Date: Mon, 1 Dec 2003 17:47:35 +0100

On Mon, Dec 01, 2003 at 03:23:43PM +0100, Ondrej Pacovsky wrote:
> Hello,
> I'm working w/ gnuplot and I'd like to have the "input" part hidden in
> postscipt export (because I want only the graph in presentation, not
> gnuplot source) - is there a way to have a hidden paragraph in texmacs?
> Of course, I can delete the input lines and keep the generated
> gnuplot-output only, but then I'll have no chance to modify the graph
> in-place.
>
> Is there some general way of changing properties of selected area? I'd
> expect right-click or something to do the above, but didn't find the
> functionality in texmacs.

You can try starting with these two macro definitions:

First one, show the contents.

(assign "mymac"
(macro "x"
(concat (with "mode" "math" "<rightarrow>")
(arg "x")
(with "mode" "math" "<leftarrow>"))))

Second one, hide the contents and the vertical space.

(assign "mymac"
(macro "x"
(with "par-sep" "-1fn"
"par-line-sep" "0"
"par-par-sep" "0" "")))

As usual, paste these using "Edit->Paste from->Scheme".

However, it seems that the trick does not work well with Sessions for
some reason. Try the following and you will see what I mean:

(document
(assign "show-scheme-input?" "false")
(assign "saved-input" (value "input"))
(assign "input"
(macro "x" "y"
(if (value "show-scheme-input?")
(saved-input (arg "x") (arg "y"))
(with "par-sep" "-1fn"
"par-line-sep" "0"
"par-par-sep" "0" ""))))
""
(with "prog-language" "scheme" "prog-session" "default"
(session (document
(input "scheme] " (document "(+ 1 1)"))
(output (document "2"))
(input "scheme] " (document ""))))))

You may also try some EXTERN magic. First define the following Scheme
functions:

(define (skip-odd l)
(if (or (null? l) (null? (cdr l)))
'()
(cons (cadr l) (skip-odd (cddr l)))))

(define (skip-odd-pars x)
(object->tree `(document ,@(skip-odd (cdr x)))))

Then use the following texmacs snippet

(document
(assign "show-input?" "false")
(assign "builtin-session" (value "session"))
(assign "session"
(macro "x"
(compound "builtin-session"
(if (value "show-input?")
(arg "x")
(extern "skip-odd-pars" (arg "x"))))))
""
(with "prog-language" "scheme" "prog-session" "default"
(session
(document
(input "scheme] " (document "(+ 1 1)"))
(output (document "2"))
(input "scheme] " (document "(+ 2 2)"))
(output (document "4")) (input "scheme] " (document ""))))))

The input is indeed hidden, but the normal behaviour of the SESSION
environment seems disabled now. There is no indentation and you cannot
move between session lines. I am under the impression that the
all-too-handy "redefine a macro" trick was broken during the recent
internal document format changes.

Joris, what is the recommanded method to redefine a macro?

--
-- ddaa


  • invisible parts, Ondrej Pacovsky, 12/01/2003
    • Re: [TeXmacs] invisible parts, David Allouche, 12/01/2003

Archive powered by MHonArc 2.6.19.

Top of page