Skip to Content.
Sympa Menu

texmacs-users - Re: [TeXmacs-users] Show/Hide texts according to a variable

Subject: mailing-list for TeXmacs Users

List archive

Re: [TeXmacs-users] Show/Hide texts according to a variable


Chronological Thread 
  • From: Frank <address@hidden>
  • To: address@hidden
  • Subject: Re: [TeXmacs-users] Show/Hide texts according to a variable
  • Date: Sun, 26 Jul 2020 09:20:17 +0200

Hi,

Thanks for the response. I wonder raise some technical questions:

1. What is the difference between "true" and (macro "true") ? I see the later in the standard packages, like (section-base.ts):

(assign "sectional-short-style" (macro "true"))

Here is a usage:

(assign "appendix-title" (macro "title" (style-with "src-compact" "none" (if (sectional-short-style) (section-title (arg "title")) (chapter-title (arg "title"))))))

The literal difference is (sectional-short-style) allows (macro "true"), while (value "sectional-short-style") will lead to an error. However, I don't know whether one has deeper reason to prefer one over another?

2. Why does it work to use "compound" while my previous version does not? I guess that it is related to the evaluation order of (if), but I don't know how.

By the way, I hope that these will be put into some Wiki document of TeXmacs.

Best wishes,

Frank

On 25/07/2020, TeXmacs wrote:
Hi Frank,

A better way is to have several macros for the "shown" and "hidden" versions
and then to use the 'compound' program for applying the appropriate version
to the body depending on the value of "draft-mode".

(document (assign "draft-mode" "true") (assign "draft-hidden" (macro "body" "")) (assign "draft-shown" (macro "body" (arg "body"))) (assign
"draft" (macro "body" (compound (if (value "draft-mode") (value "draft-shown") (value "draft-hidden")) (arg "body")))) "")

Best wishes, --Joris


On Sat, Jul 25, 2020 at 05:48:46PM +0200, Frank wrote:
Dear all,

I am trying to implement a macro which allows me to show texts
according to the value of a variable. I tried the following:

(document (assign "shown-draft" (macro "body" (if (draft-mode) (arg
"body")))) (assign "draft-mode" "true"))

However, I see that this macro is buggy. For example,

(shown-draft (document "s" "e" "alsdkjf asdlfja asdlfj asldkfj
asldfk jasldkfj lkasj alskdjf lkasjd  alsdkjfl jasdlkf jalsfj laskdj
flajsdf lkjasd lkjaslkfjlaksjdf lajs dflkjaslfkjlkj lajs ldksaj
lkajs lkfjsalk jask jfkls jladsj ljadslkj laskdj fljsd ljalksdf
jlaksdjf lkjaslkd fjalksjfd ljasl jasdlkf jlkajs lkasldk j"))

Then this extremely long line does not break. I wonder how to deal
with this properly?

Best,

Frank

--
Best wishes!
Yours,




Archive powered by MHonArc 2.6.19.

Top of Page