Subject: mailing-list for TeXmacs Users
List archive
From : Basile Audoly <address@hidden>- To: Frank <address@hidden>
- Cc: address@hidden
- Subject: Re: [TeXmacs-users] Show/Hide texts according to a variable
- Date: Sun, 26 Jul 2020 15:56:30 +0200
Hi Frank,
My two cents on your first question… (below)
> 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"))
I believe "sectional-short-style" is a macro (function) by design, i.e. it is
fed with arguments reflecting the context and evaluated. The original
implementation will confirm this and reveal its arguments.
> 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,
>
- [TeXmacs-users] Show/Hide texts according to a variable, Frank, 07/25/2020
- Re: [TeXmacs-users] Show/Hide texts according to a variable, TeXmacs, 07/25/2020
- Re: [TeXmacs-users] Show/Hide texts according to a variable, Frank, 07/26/2020
- Re: [TeXmacs-users] Show/Hide texts according to a variable, Basile Audoly, 07/26/2020
- Re: [TeXmacs-users] Show/Hide texts according to a variable, Frank, 07/26/2020
- Re: [TeXmacs-users] Show/Hide texts according to a variable, Basile Audoly, 07/26/2020
- Re: [TeXmacs-users] Show/Hide texts according to a variable, Frank, 07/26/2020
- Re: [TeXmacs-users] Show/Hide texts according to a variable, TeXmacs, 07/25/2020
Archive powered by MHonArc 2.6.19.