* Bug with \wordright in LMTX version 2020-08-03 14:25 @ 2020-08-03 20:10 Otared Kavian 2020-08-04 7:06 ` Hans Hagen 0 siblings, 1 reply; 6+ messages in thread From: Otared Kavian @ 2020-08-03 20:10 UTC (permalink / raw) To: mailing list for ConTeXt users Hi Hans, A file which used to be typeset correctly with the previous versions of lmtx, now produces an error. Despite the error message being extremely cryptic: Error ! Missing number, treated as zero I could guess the origin of the bug, which seems to be \wordright, but although the following minimal example shows a bug it does not produce the same ERROR output page: %%%% the square ''end of proof'' \definesymbol[Fin][\mathematics{\square}] \def\qed{\wordright{\symbol[Fin]}} \starttext \startformula a^2 + b^2 = c^2 \stopformula \qed % the problem is here \stoptext In the above example if one adds something before \qed, then the square end-of-proof appears. However in my real file ConTeXt ouputs an error page and says: Error ! Missing number, treated as zero. Best regards: Otared ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Bug with \wordright in LMTX version 2020-08-03 14:25 2020-08-03 20:10 Bug with \wordright in LMTX version 2020-08-03 14:25 Otared Kavian @ 2020-08-04 7:06 ` Hans Hagen [not found] ` <D707379C-DC0F-4EEA-9332-B98531BFD02E@gmail.com> 0 siblings, 1 reply; 6+ messages in thread From: Hans Hagen @ 2020-08-04 7:06 UTC (permalink / raw) To: mailing list for ConTeXt users, Otared Kavian On 8/3/2020 10:10 PM, Otared Kavian wrote: > Hi Hans, > > A file which used to be typeset correctly with the previous versions of lmtx, now produces an error. Despite the error message being extremely cryptic: > > Error ! Missing number, treated as zero > > I could guess the origin of the bug, which seems to be \wordright, but although the following minimal example shows a bug it does not produce the same ERROR output page: > > %%%% the square ''end of proof'' > \definesymbol[Fin][\mathematics{\square}] > \def\qed{\wordright{\symbol[Fin]}} > > \starttext > \startformula > a^2 + b^2 = c^2 > \stopformula > \qed % the problem is here > \stoptext > > In the above example if one adds something before \qed, then the square end-of-proof appears. > However in my real file ConTeXt ouputs an error page and says: Error ! Missing number, treated as zero. One can debate if the old behavior was ok ... wordright is meant for adding something at the end of a paragraph and you have none here. You can add a \strut in your definition to force a line. The lmtx implementation actually permit this: \definesymbol[Fin][\mathematics{\square}] \def\qed{\strut\wordright{\symbol[Fin1]}\wordright{\symbol[Fin2]}\wordright{\symbol[Fin3]}} \starttext \startformula a^2 + b^2 = c^2 \stopformula \qed % the problem is here \stoptext i'm still exploring this but it has to do with collecting stuff, as in: \wordright{before} test \par test \wordright{before} \par (i'll look at the number issue which indeed looks a like a bug) ----------------------------------------------------------------- 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <D707379C-DC0F-4EEA-9332-B98531BFD02E@gmail.com>]
[parent not found: <da525156-014d-a587-c2be-abb70ae090f4@xs4all.nl>]
* Re: Bug with \wordright in LMTX version 2020-08-03 14:25 [not found] ` <da525156-014d-a587-c2be-abb70ae090f4@xs4all.nl> @ 2020-08-04 12:02 ` Otared Kavian 2020-08-05 17:33 ` Fabrice Couvreur 0 siblings, 1 reply; 6+ messages in thread From: Otared Kavian @ 2020-08-04 12:02 UTC (permalink / raw) To: Hans Hagen, mailing list for ConTeXt users 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 <j.hagen@xs4all.nl> 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Bug with \wordright in LMTX version 2020-08-03 14:25 2020-08-04 12:02 ` Otared Kavian @ 2020-08-05 17:33 ` Fabrice Couvreur 2020-08-05 19:15 ` Wolfgang Schuster 0 siblings, 1 reply; 6+ messages in thread From: Fabrice Couvreur @ 2020-08-05 17:33 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1.1: Type: text/plain, Size: 3369 bytes --] 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 <otared@gmail.com> 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 <j.hagen@xs4all.nl> 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 > > ___________________________________________________________________________________ > [-- Attachment #1.2: Type: text/html, Size: 5683 bytes --] [-- Attachment #2: Type: text/plain, Size: 493 bytes --] ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Bug with \wordright in LMTX version 2020-08-03 14:25 2020-08-05 17:33 ` Fabrice Couvreur @ 2020-08-05 19:15 ` Wolfgang Schuster 2020-08-08 13:39 ` Defining \qed (was: Bug with \wordright...) Otared Kavian 0 siblings, 1 reply; 6+ messages in thread From: Wolfgang Schuster @ 2020-08-05 19:15 UTC (permalink / raw) To: mailing list for ConTeXt users 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 6+ messages in thread
* Defining \qed (was: Bug with \wordright...) 2020-08-05 19:15 ` Wolfgang Schuster @ 2020-08-08 13:39 ` Otared Kavian 0 siblings, 0 replies; 6+ messages in thread From: Otared Kavian @ 2020-08-08 13:39 UTC (permalink / raw) To: mailing list for ConTeXt users Hi Wolfgang, Thanks for your explanations and the correct definition of the close symbol in an enumeration. Following up the discussions with Hans, in order to put a close sympbol at the end of a formula, I have the following for the definition of \qed: %% begin example-qed.tex \showframe \definesymbol[Fin][\mathematics{\square}] \def\qed{% \ifmmode \inrightmargin{\hskip-7.5mm\symbol[Fin]} % --> attention here \else \dontleavehmode\wordright{\symbol[Fin]} \fi} \setupformulas[location=left] \starttext One sees that \placeformula \startformula a^2 + b^2 = c^2 \stopformula which is the Pythagoras theorem. \qed Another proof of Pythagors theorem is based on the figure below in which one sees that: \placeformula \startformula (a+b)^2 = c^2 + 2ab \quad \imply \quad a^2 + b^2 = c^2. \qed \stopformula \stoptext %% end example-qed.tex Now how can I replace « \hskip-7.5mm » (which was found by trial and error…) in a robust manner so that the close symbols in the formulas are vertically aligned with the close symbols in the text? In other terms can one compute automatically the amount of negative \hskip so that the definition is correct when one changes the font size and the layout? Thanks in advance: Otared > On 5 Aug 2020, at 21:15, Wolfgang Schuster <wolfgang.schuster.lists@gmail.com> wrote: > […] > > 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 > ___________________________________________________________________________________ ___________________________________________________________________________________ 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 ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-08-08 13:39 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-08-03 20:10 Bug with \wordright in LMTX version 2020-08-03 14:25 Otared Kavian 2020-08-04 7:06 ` Hans Hagen [not found] ` <D707379C-DC0F-4EEA-9332-B98531BFD02E@gmail.com> [not found] ` <da525156-014d-a587-c2be-abb70ae090f4@xs4all.nl> 2020-08-04 12:02 ` Otared Kavian 2020-08-05 17:33 ` Fabrice Couvreur 2020-08-05 19:15 ` Wolfgang Schuster 2020-08-08 13:39 ` Defining \qed (was: Bug with \wordright...) Otared Kavian
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).