Re: [NTG-context] Installing VSCode extension?

2020-08-05 Thread Mikael Sundqvist
On Wed, Aug 5, 2020 at 11:57 AM Jeong Dal  wrote:

> Dear Mikael,
>
>
> 2) Is there a nice way to compile the tex file from
>
> within vs code? As of
> now, I opened a terminal and compiled from that, but that feels like the
> wrong way of doing it.
>
>
> For the first question, I don’t know either.
> For the second question, I’d like to explain what I did for compiling TeX
> file in vscode.
> Since I use vscode in MacOsX, you may find your way in Linux.
>
> There is a tasks.json file in .vscode folder.
> I added the following script in the “tasks":[ ]  and save it.
> (You have to modify the  "texmf-osx-64/bin” path in the following script
> from your machine.
>
> {
> "label": "ConTeXt LuaMetaTeX",
> "type": "shell",
> "command": "export
> PATH=/Users/graph/ConTeXtLM/tex/texmf-osx-64/bin:$PATH;mtxrun
> --autogenerate --script context --autopdf --purge '${file}'",
> "args": [],
> "options": {
> "cwd": "${fileDirname}"
> },
> "group": {
> "kind": "build",
> "isDefault": true
> }
> },
>
> When you want to compile a ConTeXt file, find “terminal > Run Build task”
> in the menu,
> then “ConTeXt LuaMetaTex” will pop up.
> Or just use the key “command-shift-B” instead using menu item.
>
> I hope that it may help.
>
> Best wishes,
>
> Dalyoung
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
>
> ___
>

Dear Dalyoung,

Thanks! That got me up and running. Maybe this can help others (or maybe it
is well-known):

* Since January, the editor supports a global tasks.json file (if I
understood
https://stackoverflow.com/questions/41046494/making-global-tasks-in-vs-code
correctly).
I updated, and indeed, that seems to work.
* I noticed that valid macros are recognized while typing, even if one has
not used them before. When one starts typing the text is non-bold, and when
it is a known macro it gets bold. That was useful.

Best regards, Mikael
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Bug with \wordright in LMTX version 2020-08-03 14:25

2020-08-05 Thread Wolfgang Schuster

Fabrice Couvreur schrieb am 05.08.2020 um 19:33:

Hello,
I also use a square to complete a demonstration. I tried this without 
success

Thank you
Fabrice

\definesymbol[Fin][\mathematics{\square}]
\def\qed{\strut\wordright{\symbol[Fin]}}

\defineenumeration
   [proof]
   [...,
    closesymbol={\symbol[\qed]}]


1. \symbol is meant to access pre defined symbols, as fallback method 
when the requested symbol doesn't exist ConTeXt outputs the argument. 
This fallback is in my opinion problematic because it's easy to miss it.


\starttext

\symbol[square]

\symbol[quadrat]

\stoptext


2. When you use the closesymbol for a enumeration ConTeXt uses also the 
argument of the closecommand to apply something to the symbol, by 
default the argument to the closecommand key is \wordright.


This means you're putting \wordright (which itself is flushed as symbol) 
within \wordright which has to fail at some point.



Below is a cleaner version to put a symbol at the end of each proof. The 
\blank setting in the \PlaceProofSymbol definition moves the symbol back 
in the math formula to avoid the vertical space between them, you can 
remove it but I would at leas use \blank[back] to get rid of the empty 
line between the formula and the symbol.


\define[1]\PlaceProofSymbol
  {\blank[back,overlay]%
   \dontleavehmode\wordright{#1}}

\defineenumeration
  [proof]
  [ closesymbol={\symbol[square]},
   closecommand=\PlaceProofSymbol]

\starttext

\startproof
  \startformula
a^2 + b^2 = c^2
  \stopformula
\stopproof

\stoptext

Wolfgang
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Bug with \wordright in LMTX version 2020-08-03 14:25

2020-08-05 Thread Fabrice Couvreur
Hello,
I also use a square to complete a demonstration. I tried this without
success
Thank you
Fabrice

\definesymbol[Fin][\mathematics{\square}]
\def\qed{\strut\wordright{\symbol[Fin]}}

\defineenumeration
  [proof]
  [text=Démonstration,
   alternative=serried,
   distance=\zeropoint,
   number=no,
   headstyle=boldslanted,
   width=broad,
   closesymbol={\symbol[\qed]}]

\starttext
\startproof
\startformula
a^2 + b^2 = c^2
\stopformula
\stopproof
\stoptext


Le mar. 4 août 2020 à 14:02, Otared Kavian  a écrit :

> Hi Hans,
>
> Thanks for the hint which consists in adding an \ifmmode to the definition
> of \qed.
> However, as you suggest, one needs some other mechanism in math mode,
> since with your new definition of \qed the alignment of the formula changes
> when one adds this close symbol:
>
>  begin-example-qed.tex
> \definesymbol[Fin][\mathematics{\square}]
> \def\qed{\ifmmode\quad\symbol[Fin]\else\strut\wordright{\symbol[Fin]}\fi}
> \starttext
> \startformula
> a^2 + b^2 = c^2.
> \stopformula
> \startformula
> a^2 + b^2 = c^2. \qed
> \stopformula
> One sees that\type{\qed} in the formula changes the alignment of the
> formula. \qed
> \stoptext
>  end-example-qed.tex
>
> Thanks a lot for everything: Otared
>
> > On 4 Aug 2020, at 13:24, Hans Hagen  wrote:
> >
> > On 8/4/2020 11:17 AM, Otared Kavian wrote:
> >> Thanks Hans for your explanations.
> >> The problem I encountered is that, the command \qed is used dozens of
> time in my text without any issue because it was preceded by something on
> th eline, but the only place where it was alone after a formula resulted in
> the error and it was not easy for me to isolate the issue…
> >> By the way, in mkii it was possible to add \qed on the last line of a
> math formula, but that does not work anymore:
> >> \definesymbol[Fin][\mathematics{\square}]
> >> \def\qed{\strut\wordright{\symbol[Fin]}}
> >> \starttext
> >> \startformula
> >> a^2 + b^2 = c^2. \qed
> >> \stopformula
> >> The above formula does not show the close symbol.\qed
> >> \stoptext
> >> Is there a way to have something like \qed work in math formulas?
> > because that's now hwpo wordright works ...
> >
> > \def\qed{\ifmmode\quad\symbol[Fin]\else\strut\wordright{\symbol[Fin]}\fi}
> >
> > but we probably need something different, something that hooks into
> display math
> >
> > Hans
> >
> >
> > -
> >  Hans Hagen | PRAGMA ADE
> >  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
> >   tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> > -
>
>
> ___
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
>
> ___
>
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Installing VSCode extension?

2020-08-05 Thread Jeong Dal
Dear Mikael,


> 2) Is there a nice way to compile the tex file from
> within vs code? As of
> now, I opened a terminal and compiled from that, but that feels like the
> wrong way of doing it.

For the first question, I don’t know either.
For the second question, I’d like to explain what I did for compiling TeX file 
in vscode.
Since I use vscode in MacOsX, you may find your way in Linux.

There is a tasks.json file in .vscode folder.
I added the following script in the “tasks":[ ]  and save it.
(You have to modify the  "texmf-osx-64/bin” path in the following script from 
your machine.

{
"label": "ConTeXt LuaMetaTeX",
"type": "shell",
"command": "export 
PATH=/Users/graph/ConTeXtLM/tex/texmf-osx-64/bin:$PATH;mtxrun --autogenerate 
--script context --autopdf --purge '${file}'",
"args": [],
"options": {
"cwd": "${fileDirname}"
},
"group": {
"kind": "build",
"isDefault": true
}
 },

When you want to compile a ConTeXt file, find “terminal > Run Build task” in 
the menu,
then “ConTeXt LuaMetaTex” will pop up.
Or just use the key “command-shift-B” instead using menu item.

I hope that it may help.

Best wishes,

Dalyoung___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Placing a section ending depending on odd/even sectionnumber

2020-08-05 Thread Willi Egger
Wolfgang, thank you so much for your help!

Hm, when reading your explanation I start to understand my short cut in 
thinking about solving the problem.

I will build it into my project…

Thanks and kind regards
Willi

> On 4 Aug 2020, at 19:46, Wolfgang Schuster 
>  wrote:
> 
> Willi Egger schrieb am 04.08.2020 um 18:56:
>> Hi,
>> now I have another hurdle to be taken :-) — Depending on the odd or even 
>> number of the section I have to place an ornament at the end of the section.
>> I have sofar the following setup:
>> [...]
>> However the the evaluation of the sectionnumber results always in “false”, 
>> having therefore always odd as a sectionending.
> 
> You have two problem:
> 
> 1. To get the current value for \currentheadnumber you have use 
> \determineheadnumber[section] before you use it but the example below shows a 
> better method.
> 
> 2. What you do with \doifelse{...}{even} is to compare the numeric value of 
> the section with the string "even" which is always false. To check whether 
> the value is odd or even you have to use the \ifodd command.
> 
>> What to change in order to get the desired result?
> 
>  begin example
> \startsetups [section:odd]
> \vfill
> \bold {End of odd numbered section}
> \stopsetups
> 
> \startsetups [section:even]
> \vfill
> \bold {End of even numbered section}
> \stopsetups
> 
> \startsetups [section:end]
> \ifodd\namedheadnumber{section}
>  \directsetup{section:odd}
> \else
>  \directsetup{section:even}
> \fi
> \stopsetups
> 
> \setuphead
> [section]
> [aftersection=\directsetup{section:end}]
> 
> \starttext
> 
> \startsection[title=Ward]
> \input ward
> \stopsection
> 
> \page
> 
> \startsection[title=Knuth]
> \input knuth
> \stopsection
> 
> \stoptext
>  end example
> 
> Wolfgang
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___