Hello, it seems this is a frequent thesis - in the mailing archive, stackoverflow... Anyway, I'm not able to find a valid way (MWE) how to number subformulas (with option to create a reference name, like 'eq:1a' and 'eq:1b', and to be able to refer to them, like "\ineq[eq:1a] and \ineq[eq:1b]"), so to get something like: " Some text a + b = c (1a) and later d + e = f (1b) so nothing surprising in [1a] and [1b]. " Moreover, on http://wiki.contextgarden.net/Math there is a red "Warning!": " If you consider using ConTeXt for a paper with a proper formula numbering please wait until it is implemented in mkiv. At the moment only a very limited formula numbering is possilbe: number formula(s) with a plain number number formula(s) with a subnumber Not possible is at the moment: Table of formulas Named subformulas Mixure of formulas and subformulas in one block Reference on a (sub-)formula without having it listed in the Table of formulas For more details and actual state see mailing list and Summary of formula numbering problem. " I don't know which date this warning comes from, if it is outdated or still valid... So, finally, what is the PROPER way (if it really exists) in ConTeXt how to typeset subformulas? (I'm typesetting a large article on physics which contains many math (sub-)formulas, so knowledge of a working tool for Ctx would be nice...) Best regards, Lukas -- Ing. Lukáš Procházka | mailto:LPr@pontex.cz Pontex s. r. o. | mailto:pontex@pontex.cz | http://www.pontex.cz Bezová 1658 147 14 Praha 4 Tel: +420 241 096 751 Fax: +420 244 461 038
Hello,
some more observation:
It seems (sub)numbering (sub)formulas can be achieved enclosing expressions into \start/\stop-align.
I wrote a code based on a test suite file:
...\test\doc\context\tests\mkiv\math\formulas-001.tex
----
\starttext
\startsubformulas[eq:sub1]
\placeformula
\startformula
\startalign
\NC a_1 x + b_1 y \NC = c_1 \NR[eq:11]
\NC a_2 x + b_2 y \NC = c_2 \NR[eq:12]
\stopalign
\stopformula
\stopsubformulas
\in{eq:11}[eq:11]
\in{eq:12}[eq:12]
\placeformula
\startformula
\startsubformulas[eq:sub2]
\startalign
\NC a_1 x + b_1 y \NC = c_1 \NR[eq:21]
\NC a_2 x + b_2 y \NC = c_2 \NR[eq:22]
\stopalign
\stopsubformulas
\stopformula
\input knuth
\placeformula
\startformula
\startsubformulas[eq:sub2]
\startalign
\NC a_1 x + b_1 y \NC = c_1 \NR[eq:31]
\NC a_2 x + b_2 y \NC = c_2 \NR[eq:32]
\stopalign
\stopsubformulas
\stopformula
\in{eq:31}[eq:31]
\in{eq:32}[eq:32]
\stoptext
----
Problems are:
1. I am not able to make numbering of eq:31 and eq:32 continue on eq:22, so to have equations numbered:
1a, 1b; 2a, 2b; 2c, 2d
instead of:
1a, 1b; 2a, 2b; 3a, 3b
(Some text - here: knuth - between 2b and 3a/2c is required.)
(I played with commenting some combinations of lines but with no success.)
So - is there a way how to continue numbering subformulas (after some inserted text) - something like itemizing has \startitemize[continue]?
2. How to affect the numbering style to be "1a" instead "1.a"?
3. @Hans: The test suite file:
...\test\doc\context\tests\mkiv\math\subformulas-001.tex
compiles, but gives "no-reference" "??".
(
The example on wiki:
http://wiki.contextgarden.net/Math/Display#Automatic_Sub-Formula_Numbering
seems to be very ancient as it GIVES the desired result.
)
Lukas
On Mon, 03 Aug 2015 12:20:44 +0200, Procházka Lukáš Ing. - Pontex s. r. o.
Hello,
it seems this is a frequent thesis - in the mailing archive, stackoverflow...
Anyway, I'm not able to find a valid way (MWE) how to number subformulas (with option to create a reference name, like 'eq:1a' and 'eq:1b', and to be able to refer to them, like "\ineq[eq:1a] and \ineq[eq:1b]"), so to get something like:
" Some text a + b = c (1a) and later d + e = f (1b) so nothing surprising in [1a] and [1b]. "
Moreover, on http://wiki.contextgarden.net/Math there is a red "Warning!":
" If you consider using ConTeXt for a paper with a proper formula numbering please wait until it is implemented in mkiv. At the moment only a very limited formula numbering is possilbe: number formula(s) with a plain number number formula(s) with a subnumber
Not possible is at the moment: Table of formulas Named subformulas Mixure of formulas and subformulas in one block Reference on a (sub-)formula without having it listed in the Table of formulas
For more details and actual state see mailing list and Summary of formula numbering problem. "
I don't know which date this warning comes from, if it is outdated or still valid...
So, finally, what is the PROPER way (if it really exists) in ConTeXt how to typeset subformulas?
(I'm typesetting a large article on physics which contains many math (sub-)formulas, so knowledge of a working tool for Ctx would be nice...)
Best regards,
Lukas
-- Ing. Lukáš Procházka | mailto:LPr@pontex.cz Pontex s. r. o. | mailto:pontex@pontex.cz | http://www.pontex.cz Bezová 1658 147 14 Praha 4 Tel: +420 241 096 751 Fax: +420 244 461 038
On Mon, 3 Aug 2015, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
So, finally, what is the PROPER way (if it really exists) in ConTeXt how to typeset subformulas?
I am not sure when the subformula numbering broke, but I can confirm that it is not working with the latest beta. @Hans, what will be the MkIV approach to define subformulas (or rather, nested counters). Aditya
Aditya Mahajan mailto:adityam@umich.edu 4. August 2015 02:08 On Mon, 3 Aug 2015, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
I am not sure when the subformula numbering broke, but I can confirm that it is not working with the latest beta. You have to make three changes in strc-mat.mkiv to fix subformula numbering.
The first change is necessary to show the even when there isn’t a argument for \startsubformulas. The second change is necessary to prevent context from reseting the mode for subnumbers at the end of each formula. The changes in \stopsubfomulas is necessary because of the test in \everyresetformulas. \def\strc_formulas_number_indeed {\ifconditional\c_strc_formulas_handle_number \hbox\bgroup % main counter \ifconditional\c_strc_formulas_inside_formulas_sub % nothing \else \ifcase\c_strc_formulas_number_mode \ifcase\c_strc_formulas_place_number_mode \strc_formulas_handle_numbering \or \strc_formulas_handle_numbering \or % nothing \or \strc_formulas_handle_numbering \fi \or \strc_formulas_handle_numbering \or % nothing \or \strc_formulas_handle_numbering \fi \fi % subcounter \ifconditional\c_strc_formulas_inside_formulas_sub \ifcase\c_strc_formulas_sub_number_mode - % nothing + \strc_formulas_handle_sub_numbering \or \strc_formulas_handle_sub_numbering \or % nothing \or \strc_formulas_handle_sub_numbering \fi \fi \strc_formulas_reference_trace \egroup \fi} \appendtoks \c_strc_formulas_place_number_mode \zerocount \c_strc_formulas_number_mode \zerocount - \c_strc_formulas_sub_number_mode \zerocount + \ifconditional\c_strc_formulas_inside_formulas_sub \else + \c_strc_formulas_sub_number_mode\zerocount + \fi \c_strc_formulas_nested_number_mode\zerocount \to \everyresetformulas \unexpanded\def\stopsubformulas {\nonoindentation \useindentnextparameter\subformulaparameter - \the\everyresetformulas % to be checked \global\setfalse\c_strc_formulas_inside_formulas_sub + \the\everyresetformulas % to be checked \dorechecknextindentation} % here ? %%%% begin example \usemodule[visual] \starttext \placeformula \startformula \fakeformula \stopformula %\startsubformulas[+] % These two options for \subformulas %\startsubformulas[mylabel] % enable subnumbers for the formulas \startsubformulas \placeformula \startformula \fakeformula \stopformula \placeformula \startformula \fakeformula \stopformula \stopsubformulas \stoptext %%%% end example Wolfgang
Hello Wolfgang,
thank you for the patch (not in today's beta); I also attach the modified strc-mat.mkiv and a test file.
Two questions:
1.
What exactly are
%\startsubformulas[+] % These two options for \subformulas
%\startsubformulas[mylabel] % enable subnumbers for the formulas
intended for?
The simple "\startsubformulas[eq:b]" meets my needs (subformulas are sub-numbered) and I can't see any difference to "\startsubformulas[+]".
2.
Is there a way to setup numbering subformulas to "(1a)" form instead of "(1.a)", i.e. set the separator to ""?
Best regards,
Lukas
On Thu, 06 Aug 2015 01:25:10 +0200, Wolfgang Schuster
Aditya Mahajan mailto:adityam@umich.edu 4. August 2015 02:08 On Mon, 3 Aug 2015, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
I am not sure when the subformula numbering broke, but I can confirm that it is not working with the latest beta. You have to make three changes in strc-mat.mkiv to fix subformula numbering.
The first change is necessary to show the even when there isn’t a argument for \startsubformulas.
The second change is necessary to prevent context from reseting the mode for subnumbers at the end of each formula.
The changes in \stopsubfomulas is necessary because of the test in \everyresetformulas.
\def\strc_formulas_number_indeed {\ifconditional\c_strc_formulas_handle_number \hbox\bgroup % main counter \ifconditional\c_strc_formulas_inside_formulas_sub % nothing \else \ifcase\c_strc_formulas_number_mode \ifcase\c_strc_formulas_place_number_mode \strc_formulas_handle_numbering \or \strc_formulas_handle_numbering \or % nothing \or \strc_formulas_handle_numbering \fi \or \strc_formulas_handle_numbering \or % nothing \or \strc_formulas_handle_numbering \fi \fi % subcounter \ifconditional\c_strc_formulas_inside_formulas_sub \ifcase\c_strc_formulas_sub_number_mode - % nothing + \strc_formulas_handle_sub_numbering \or \strc_formulas_handle_sub_numbering \or % nothing \or \strc_formulas_handle_sub_numbering \fi \fi \strc_formulas_reference_trace \egroup \fi}
\appendtoks \c_strc_formulas_place_number_mode \zerocount \c_strc_formulas_number_mode \zerocount - \c_strc_formulas_sub_number_mode \zerocount + \ifconditional\c_strc_formulas_inside_formulas_sub \else + \c_strc_formulas_sub_number_mode\zerocount + \fi \c_strc_formulas_nested_number_mode\zerocount \to \everyresetformulas
\unexpanded\def\stopsubformulas {\nonoindentation \useindentnextparameter\subformulaparameter - \the\everyresetformulas % to be checked \global\setfalse\c_strc_formulas_inside_formulas_sub + \the\everyresetformulas % to be checked \dorechecknextindentation} % here ?
%%%% begin example \usemodule[visual]
\starttext
\placeformula \startformula \fakeformula \stopformula
%\startsubformulas[+] % These two options for \subformulas %\startsubformulas[mylabel] % enable subnumbers for the formulas \startsubformulas
\placeformula \startformula \fakeformula \stopformula
\placeformula \startformula \fakeformula \stopformula
\stopsubformulas
\stoptext %%%% end example
Wolfgang
-- Ing. Lukáš Procházka | mailto:LPr@pontex.cz Pontex s. r. o. | mailto:pontex@pontex.cz | http://www.pontex.cz Bezová 1658 147 14 Praha 4 Tel: +420 241 096 751 Fax: +420 244 461 038
Procházka Lukáš Ing. - Pontex s. r. o. mailto:LPr@pontex.cz 6. August 2015 11:32 Hello Wolfgang,
thank you for the patch (not in today's beta); I also attach the modified strc-mat.mkiv and a test file.
Two questions:
1.
What exactly are
%\startsubformulas[+] % These two options for \subformulas %\startsubformulas[mylabel] % enable subnumbers for the formulas
intended for?
The simple "\startsubformulas[eq:b]" meets my needs (subformulas are sub-numbered) and I can't see any difference to "\startsubformulas[+]". When you write \startsubformulas[-] the numbers for the formulas aren't displayed in the output but the counter is still increased. I guess \startsubformulas[+] is just there for completeness sake because there are other functions with "-" and "+" options as well.
One difference between \startsubformulas[+] and \startsubformulas[label] is that the second method creates a label which can be used to refer to the number of the formula.
2.
Is there a way to setup numbering subformulas to "(1a)" form instead of "(1.a)", i.e. set the separator to ""? You have to change the separator list with the numberseparator key for \setupformulas.
\defineseparatorset[none][][] \setupformulas[numberseparatorset=none] Wolfgang
Hello,
great, thanks for explanation!
Best regards,
Lukas
On Thu, 06 Aug 2015 12:07:18 +0200, Wolfgang Schuster
One difference between \startsubformulas[+] and \startsubformulas[label] is that the second method creates a label which can be used to refer to the number of the formula.
You have to change the separator list with the numberseparator key for \setupformulas.
\defineseparatorset[none][][] \setupformulas[numberseparatorset=none]
Wolfgang
-- Ing. Lukáš Procházka | mailto:LPr@pontex.cz Pontex s. r. o. | mailto:pontex@pontex.cz | http://www.pontex.cz Bezová 1658 147 14 Praha 4 Tel: +420 241 096 751 Fax: +420 244 461 038
Hi Wolfgang, Thanks for having solved the problem with subformulas numbering. I would just make a comment on your answers to Lukás, regarding the use of \startsubformulas[mylabel] Indeed using this structure instead of \startsubformulas[+] allows one to refer to all the sub-formulas by invoking (\in[mylabel]), but if one wishes to refer to any individual sub-formula one has to give a label inside the structure \start—\stop—subformulas, at the level of \placeformula for that sub-formula. Below is your example, with these remarks. Thanks for your attention and help: OK %%%% begin example \usemodule[visual] \starttext Using the definition of the scalar product we infer that: \placeformula[eq:1] \startformula \fakeformula \stopformula And here are some other relations valid in a Hilbert space: %\startsubformulas[+] % These two options for \subformulas %\startsubformulas[mylabel] % enable subnumbers for the formulas \startsubformulas \placeformula[eq:2-a] \startformula \fakeformula \stopformula \placeformula[eq:2-b] \startformula \fakeformula \stopformula \stopsubformulas It is clear that the equality (\in[eq:2-b]) is a consequence of (\in[eq:1]) and (\in[eq:2-a]). % To test how to change the number separator \defineseparatorset[none][][] \setupformulas[numberseparatorset=none] \startsubformulas[eq:3] \placeformula \startformula \fakeformula \stopformula \placeformula \startformula \fakeformula \stopformula \stopsubformulas Prove relations (\in[eq:3]) using (\in[eq:1]). \stoptext %%%% end example
On 06 Aug 2015, at 12:07, Wolfgang Schuster
wrote: Procházka Lukáš Ing. - Pontex s. r. o. mailto:LPr@pontex.cz 6. August 2015 11:32 Hello Wolfgang,
thank you for the patch (not in today's beta); I also attach the modified strc-mat.mkiv and a test file.
Two questions:
1.
What exactly are
%\startsubformulas[+] % These two options for \subformulas %\startsubformulas[mylabel] % enable subnumbers for the formulas
intended for?
The simple "\startsubformulas[eq:b]" meets my needs (subformulas are sub-numbered) and I can't see any difference to "\startsubformulas[+]". When you write \startsubformulas[-] the numbers for the formulas aren’t displayed in the output but the counter is still increased. I guess \startsubformulas[+] is just there for completeness sake because there are other functions with “-” and “+” options as well.
One difference between \startsubformulas[+] and \startsubformulas[label] is that the second method creates a label which can be used to refer to the number of the formula.
2.
Is there a way to setup numbering subformulas to "(1a)" form instead of "(1.a)", i.e. set the separator to ""? You have to change the separator list with the numberseparator key for \setupformulas.
\defineseparatorset[none][][] \setupformulas[numberseparatorset=none]
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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
Hello, one more question related to the numbering style. The code bellow: ---- \def\fakeformula{a^2 + b^2 = c^2} \starttext \chapter{Cha1} \section{A} \placeformula\startformula\fakeformula\stopformula \section{B} \placeformula\startformula\fakeformula\stopformula \subsection{Ba} \placeformula\startformula\fakeformula\stopformula \stoptext ---- gives numbers in form of "(1.1)", "(1.2)" and "(1.3)". Is there a way to get simple continuous numbering within the same \chapter (or, similarly, \part in the case of a larger document) - so to produce "(1)", "(2)" and "(3)" in this case? Best regards, Lukas -- Ing. Lukáš Procházka | mailto:LPr@pontex.cz Pontex s. r. o. | mailto:pontex@pontex.cz | http://www.pontex.cz Bezová 1658 147 14 Praha 4 Tel: +420 241 096 751 Fax: +420 244 461 038
Hi Lukás, You configure the way the equations are numbered by sayng (for example) \setupformulas[prefix=yes, prefixsegments=chapter:section, way=bysection, location=right] If you say « prefix= no » then you don’t need the other specifications, but I am giving a more example above in case you want to adapt it to your needs. Best regards: OK
On 06 Aug 2015, at 16:03, Procházka Lukáš Ing. - Pontex s. r. o.
wrote: Hello,
one more question related to the numbering style. The code bellow:
---- \def\fakeformula{a^2 + b^2 = c^2}
\starttext \chapter{Cha1} \section{A} \placeformula\startformula\fakeformula\stopformula
\section{B} \placeformula\startformula\fakeformula\stopformula
\subsection{Ba} \placeformula\startformula\fakeformula\stopformula \stoptext ----
gives numbers in form of "(1.1)", "(1.2)" and "(1.3)".
Is there a way to get simple continuous numbering within the same \chapter (or, similarly, \part in the case of a larger document) - so to produce "(1)", "(2)" and "(3)" in this case?
Best regards,
Lukas
-- Ing. Lukáš Procházka | mailto:LPr@pontex.cz Pontex s. r. o. | mailto:pontex@pontex.cz | http://www.pontex.cz Bezová 1658 147 14 Praha 4
Tel: +420 241 096 751 Fax: +420 244 461 038
___________________________________________________________________________________ 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://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
Hello Otared,
thanks for the hint. However, I'm still not able to tune the numbering setup fully.
Now I have (with resulting numbers | desired number):
----
\setuphead[part,chapter][placehead=yes,page=no]
\setupformulas
[prefix=yes,
%prefix=no,
%prefixsegments=chapter:section,
prefixsegments=part,
way=bysection,
%way=bytext,
%location=right,
]
\def\fakeformula{a^2 + b^2 = c^2}
\starttext
\part{P1}
\chapter{Cha1}
\section{A}
\placeformula\startformula\fakeformula\stopformula % 1.1 | 1.1 be "part 1, formula #1 in the part"
\section{B}
\placeformula\startformula\fakeformula\stopformula % 1.1 | 1.2 be "part 1, formula #2 in the part"
\subsection{Ba}
\placeformula\startformula\fakeformula\stopformula % 1.2 | 1.3 be "part 1, formula #3 in the part"
\chapter{Cha2}
\section{A}
\placeformula\startformula\fakeformula\stopformula % 1.1 | 1.4 be "part 1, formula #4 in the part"
\part{P2}
\chapter{Cha1}
\section{A}
\placeformula\startformula\fakeformula\stopformula % 2.1 | 2.1 be "part 2, formula #1 in the part"
\stoptext
----
So the problem here is that EVERY SECTION resets the formula counter, whilst I would need only \part to reset the counter, something like "[way=bypart]".
I played somehow with \setupformulas keys but without the wanted output...
Is there a way?
Best regards,
Lukas
On Thu, 06 Aug 2015 16:38:35 +0200, Otared Kavian
Hi Lukás,
You configure the way the equations are numbered by sayng (for example)
\setupformulas[prefix=yes, prefixsegments=chapter:section, way=bysection, location=right]
-- Ing. Lukáš Procházka | mailto:LPr@pontex.cz Pontex s. r. o. | mailto:pontex@pontex.cz | http://www.pontex.cz Bezová 1658 147 14 Praha 4 Tel: +420 241 096 751 Fax: +420 244 461 038
Procházka Lukáš Ing. - Pontex s. r. o. mailto:LPr@pontex.cz 6. August 2015 17:41 Hello Otared,
thanks for the hint. However, I'm still not able to tune the numbering setup fully.
Now I have (with resulting numbers | desired number):
---- \setuphead[part,chapter][placehead=yes,page=no]
\setupformulas [prefix=yes, %prefix=no, %prefixsegments=chapter:section, prefixsegments=part, way=bysection, way=bypart,
Wolfgang
participants (4)
-
Aditya Mahajan
-
Otared Kavian
-
Procházka Lukáš Ing. - Pontex s. r. o.
-
Wolfgang Schuster