[NTG-context] how to change metadata halfway through document

2023-01-29 Thread jbf via ntg-context
Am trying to understand how best to change the title metadata in 
headertext halfway through a document that has two parts: Constitutions 
and Regulations.


My first attempt (did not work)

\startsetups[headertext]

\startdocument

[metadata:title={Regulations}]

\stopsetups

\setupheadertexts

[ ] [{\getmarking[chapter]\hskip1em \pagenumber}]

[{\pagenumber \hskip1em \setup{headertext}}] [ ]

My second attempt (quite crass, but it works!!) was to create a second 
\startdocument within the main \startdocument (obviously closing it 
towards the end but before the main \stopdocument), this time with 
[metadata:title={Regulations}] instead of the original 
[metadata:title={Constitutions}]. However, I have a strong feeling this 
is not a very elegant solution!


Thoughts?

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

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


Re: [NTG-context] How to create multi-line headers and footers?

2023-01-29 Thread Henning Hraban Ramm via ntg-context

Am 29.01.23 um 18:14 schrieb Joel via ntg-context:

I am creating a template for a 1-page newsletter.

At the top of every page is a huge title, below which is a block with a 
brief introduction to the newsletter. The body is just 200-300 words 
each issue--I edit it such that all of the content fits on just 
one-side, one page. Finally, in the footer, is contact information and 
some other closing details.


==
TITLE <-- big title
 <-- introduction paragraph

==
--
-- <-- body text
--
==
 <-- message in footer
==

I tried placing that all into a macro called "\introduction" then 
calling with this


\setupheadertexts[\introduction]


Better use setups instead of a macros, like in
https://wiki.contextgarden.net/Headers_and_Footers

In setups, you must use explicit space commands, since whitespace 
doesn’t matter.


It seems when placing the macro inside \setupheadertexts, the text is 
reduced to a single line. Any code involving \frames{} doesn't seem to 
work normally. Its all compressed to a single line, then centered.
How can I put a mult-line frame or multi-line text in the headers and 
footers?


MWE please.

Hraban

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

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


Re: [NTG-context] Best way to access casul fonts

2023-01-29 Thread Mattias Märka via ntg-context
Hi

This is probably the most reasonable solution.

Thanks
Mattias

--- Original Message ---
On Tuesday, January 24th, 2023 at 9:41 AM, Pablo Rodriguez via ntg-context 
 wrote:


> 
> 
> 
> On 1/23/23 20:32, Mattias Märka via ntg-context wrote:
> 
> > Hi Pablo,
> > 
> > Yes, I want to mix casual with serif, sans-serif and so on.
> 
> Hi Mattias (please, excuse my previous misspelling of your name),
> 
> here you have it:
> 
> \definefontfamily[mainface][rm][TeX Gyre Pagella]
> \definefontfamily[mainface][ss][TeX Gyre Heros]
> \definefontfamily[mainface][tt][TeX Gyre Cursor]
> \definefontfamily[mainface][hw][Lucida Casual]
> \definefontfamily[mainface][cg][Lucida Casual]
> \setupbodyfont[mainface]
> \starttext
> \doloopoverlist{\rm,\ss,\tt,\hw,\cg}
> {{\recursestring%
> The quick brown fox jumps over the lazy dog.\par}}
> \stoptext
> 
> Lucida Casual is handwriting and calligraphy in the sample. But you only
> need one of them.
> 
> I hope it helps,
> 
> Pablo
> ___
> If your question is of interest to others as well, please add an entry to the 
> Wiki!
> 
> maillist : ntg-context@ntg.nl / 
> https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage : https://www.pragma-ade.nl / http://context.aanhet.net
> archive : https://bitbucket.org/phg/context-mirror/commits/
> wiki : https://contextgarden.net
> ___
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] Wrong prefix in cross references to formulas in external document

2023-01-29 Thread Alan Braslau via ntg-context
I, too, am struggling with external (and internal) references.
I have created (and sent to Hans) a MWE that seems to identify two bugs:

1) External references: in a single product, some of these work, and
*some* do not render the numbers (using \in{} [ref], for example). They
are, however, identified as known or "verified".

2) Internal references: all render but *some* get "missing link target"
errors (in the PDF viewer).

I have not been able to get anywhere with the (lua) code, myself.

Alan




On Sun, 29 Jan 2023 19:03:32 +0300
Yaroslav Beltukov via ntg-context  wrote:

> Dear Hans and all contributors,
> 
> I really appreciate ConTeXt for the right way to obtain high quality
> documents. I'm a theoretical physicist and I'm going to write a book.
> I think ConTeXt is the right choice to work with a number of formulas,
> figures and cross-references. The visual quality of formulas is
> better than in regular LaTeX. The new feature with formula
> autosplitting looks also very promising. For me it is important to
> obtain the high quality without a lot of manual tweaks of each
> formula for each given document format and figure placement.
> 
> However, I have found a problem with references if I compile one
> component only. The references to formulas in other components have
> wrong prefixes, e.g. (2.1) instead of (3.1). Needless to say, the
> right formula references are very important.
> 
> I started looking into this issue. The references to other components
> are taken from the whole product as from an external document. It
> turned out that this is a general problem with references with
> prefixes to external documents. The prefix is stored in a tuc file as
> a reference to a section as a sequential number of the header in the
> document. As a result, the prefix from the external document is
> calculated using the structure of the current document.
> 
> Here is the MWE, which consists of two files:
> foo.tex:
> 
> \defineenumeration[remark][prefix=yes, prefixsegments=chapter:section]
> 
> \starttext
> 
> Equations: \in[eq1], \in[eq2], \in[eq3], \in[eq4]
> 
> Sections: \in[sec1], \in[sec2], \in[sec3], \in[sec4]
> 
> Chapters: \in[chap1], \in[chap2], \in[chap3], \in[chap4]
> 
> Remarks: \in[remark1], \in[remark2]
> 
> \startbodymatter
> 
> \chapter[chap1]{Chapter}
> \placeformula[eq1]\startformula x = y\stopformula
> \chapter[chap2]{Chapter}
> \section[sec1]{Section}
> \section[sec2]{Section}
> \placeformula[eq1]\startformula x = y\stopformula
> \placeformula[eq2]\startformula x = y\stopformula
> 
> \stopbodymatter
> 
> \startappendices
> 
> \chapter[chap3]{Chapter}
> \section[sec3]{Section}
> \placeformula[eq3]\startformula x = y\stopformula
> \section[sec4]{Section}
> \startremark[remark1]\stopremark
> \placeformula[eq4]\startformula x = y\stopformula
> \startremark[remark2]\stopremark
> \chapter[chap4]{Chapter}
> 
> \stopappendices
> 
> \stoptext
> 
> 
> bar.tex:
> 
> \starttext
> 
> Equations: \in[foo::eq1], \in[foo::eq2], \in[foo::eq3], \in[foo::eq4]
> 
> Sections: \in[foo::sec1], \in[foo::sec2], \in[foo::sec3],
> \in[foo::sec4]
> 
> Chapters: \in[foo::chap1], \in[foo::chap2], \in[foo::chap3],
> \in[foo::chap4]
> 
> Remarks: \in[foo::remark1], \in[foo::remark2]
> 
> % any chapters and sections here
> 
> \stoptext
> 
> It is expected to have the same first page on these documents:
> 
> Equations: 1.1, 2.2, A.1, A.2
> Sections: 2.1, 2.2, A.1, A.2
> Chapters: 1, 2, A, B
> Remarks: A.2.1, A.2.2
> 
> However, the bar.tex produces wrong prefixes to formulas and remarks.
> The output depends on the document structure of bar.tex, not foo.tex.
> 
> I started looking into the source code. Thanks to lua, it is not a
> big deal to track the problem. The prefixdata is complemented by the
> sectiondata after the loading the tuc file. So, the question is: is
> it possible to store the full prefixdata with all necessary prefix
> numbers in the tuc file? Here is my proposal to change the source
> code:
> 
> --- strc-lst-old.lmt2023-01-29 11:30:15.610309948 +0300
> +++ strc-lst.lmt2023-01-29 12:10:08.864228923 +0300
> @@ -266,6 +266,16 @@
>  if r and not r.section then
>  r.section = structures.sections.currentid()
>  end
> +-- store sectiondata in prefixdata (necessary for external files)
> +if t.prefixdata and r.section then
> +local sectiondata = structures.sections.collected[r.section]
> +if sectiondata then
> +for k, v in next, sectiondata do
> +t.prefixdata[k] = v
> +end
> +end
> +end
> +--
>  local b = r and t.block
>  if r and not b then
>  local s = r.section
> 
> --- strc-ref-old.lmt2023-01-29 11:30:15.823643904 +0300
> +++ strc-ref.lmt2023-01-29 12:07:45.697109862 +0300
> @@ -2318,7 +2318,17 @@
>  if data then
>  numberdata = lists.reordered(data) -- data.numberdata
>  if numberdata then
> -helpers.prefix(data,prefixspec)
> +   

[NTG-context] How to create multi-line headers and footers?

2023-01-29 Thread Joel via ntg-context
I am creating a template for a 1-page newsletter.
At the top of every page is a huge title, below which is a block with a brief 
introduction to the newsletter. The body is just 200-300 words each issue--I 
edit it such that all of the content fits on just one-side, one page. Finally, 
in the footer, is contact information and some other closing details.

==TITLE <-- big title
 <-- introduction paragraph

==
 <-- body text
--== <-- message in footer
==

I tried placing that all into a macro called "\introduction" then calling with 
this 

\setupheadertexts[\introduction]
It seems when placing the macro inside \setupheadertexts, the text is reduced 
to a single line. Any code involving \frames{} doesn't seem to work normally. 
Its all compressed to a single line, then centered.
How can I put a mult-line frame or multi-line text in the headers and footers?
--Joel

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

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


Re: [NTG-context] Can ConTeXt print specific paragraph and sentences from an input file?

2023-01-29 Thread Joel via ntg-context
I've tried to keep all of the input files entirely plain text, as much as 
possible. The exception is two custom macros used to mark citations that are in 
the text, \turabian{}{}{} and \ibid{}{}{}. I could find no way of getting 
around including that in the text, as legally I must include the citations. The 
rest of the text is plain text with no other ConTeXt markup, or at leave hardly 
any.
--Joel

   On Thursday, January 26, 2023 at 11:44:07 PM MST, Hans Hagen via ntg-context 
 wrote:  
 
 On 1/27/2023 4:22 AM, Joel via ntg-context wrote:
> Assuming I have an input file with an essay:
> 
> \starttext
> 
> \input essay
> 
> \stoptext
> 
> 
> Is there any command to tell ConTeXt to print a specific sentence, e.g. 
> the first sentence from paragraph 2, or the last sentence from paragraph 
> 1, etc?
depends on the kind of input, coding etc .. how reliable is is to 
recognize a sentence and such, but given that tex is a programing 
environment all is possible in the end

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 / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki    : https://contextgarden.net
___
  ___
If your question is of interest to others as well, please add an entry to the 
Wiki!

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


Re: [NTG-context] Subject: Leading spaces verbatim

2023-01-29 Thread Kalouguine Andre via ntg-context
On 28.01.2023 22:54, Hans Hagen via ntg-context wrote:

> On 1/28/2023 9:26 PM, Kalouguine Andre via ntg-context wrote: On 28.01.2023 
> 17:37, Pablo Rodriguez via ntg-context wrote:
> 
> Using Fedora 37 (and having just installed Okular), I see that
> annotations are tricky to open in Okular.
> 
> First you have to select the Annotations tab on the left pane, go to the
> annotation and then right-click on it to open (the pop-up note).
> 
> Evince has a more effective approach: double-clicking on the icon opens
> the note (afaIk, this is similar to Acrobat). Right you are, it works with 
> your method, thanks!
> I think the students have Evince so perhaps it's the best solution in the 
> absence
 there are some provisions for spaces in text but for verbatim it is a
bit more tricky

\setuptyping[space=on]

you now see visual spaces show up that can be copied

now, say that we add real spaces, which you can do after and this (in
cont-new.mkxl):

\unprotect
\setvalue{\??typingspace\v!character}{\chardef\obeyedspace32 }
\protect

and then:

\setuptyping[space=character]

in sumatra pdf:

default   : spaces are copied as spaces (so three become three
on: visual spaces for every one
character : funny newlines when more than two spaces 

OK, I see, thanks for the explanation! Indeed, when I look at the
makeup, there is no glue there to offset the line. But in Okular it just
ignores those spaces. 

> Cheats that add some kerning before and after confuse viewers even more.
> 
> so: this is all very viewer dependent! (The suggested comment method is more 
> reliable.)
> 
> Hans

Unfortunately as I just found out, comments are also viewer dependent...
For instance in Firefox, indentations are lost. 

So for now, attached files for longer snippets and visual spaces with a
string replacement operation afterwards are the way to go it seems. 

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

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


[NTG-context] Wrong prefix in cross references to formulas in external document

2023-01-29 Thread Yaroslav Beltukov via ntg-context
Dear Hans and all contributors,

I really appreciate ConTeXt for the right way to obtain high quality
documents. I'm a theoretical physicist and I'm going to write a book. I
think ConTeXt is the right choice to work with a number of formulas,
figures and cross-references. The visual quality of formulas is better than
in regular LaTeX. The new feature with formula autosplitting looks also
very promising. For me it is important to obtain the high quality without a
lot of manual tweaks of each formula for each given document format and
figure placement.

However, I have found a problem with references if I compile one component
only. The references to formulas in other components have wrong prefixes,
e.g. (2.1) instead of (3.1). Needless to say, the right formula references
are very important.

I started looking into this issue. The references to other components are
taken from the whole product as from an external document. It turned out
that this is a general problem with references with prefixes to external
documents. The prefix is stored in a tuc file as a reference to a section
as a sequential number of the header in the document. As a result, the
prefix from the external document is calculated using the structure of the
current document.

Here is the MWE, which consists of two files:
foo.tex:

\defineenumeration[remark][prefix=yes, prefixsegments=chapter:section]

\starttext

Equations: \in[eq1], \in[eq2], \in[eq3], \in[eq4]

Sections: \in[sec1], \in[sec2], \in[sec3], \in[sec4]

Chapters: \in[chap1], \in[chap2], \in[chap3], \in[chap4]

Remarks: \in[remark1], \in[remark2]

\startbodymatter

\chapter[chap1]{Chapter}
\placeformula[eq1]\startformula x = y\stopformula
\chapter[chap2]{Chapter}
\section[sec1]{Section}
\section[sec2]{Section}
\placeformula[eq1]\startformula x = y\stopformula
\placeformula[eq2]\startformula x = y\stopformula

\stopbodymatter

\startappendices

\chapter[chap3]{Chapter}
\section[sec3]{Section}
\placeformula[eq3]\startformula x = y\stopformula
\section[sec4]{Section}
\startremark[remark1]\stopremark
\placeformula[eq4]\startformula x = y\stopformula
\startremark[remark2]\stopremark
\chapter[chap4]{Chapter}

\stopappendices

\stoptext


bar.tex:

\starttext

Equations: \in[foo::eq1], \in[foo::eq2], \in[foo::eq3], \in[foo::eq4]

Sections: \in[foo::sec1], \in[foo::sec2], \in[foo::sec3], \in[foo::sec4]

Chapters: \in[foo::chap1], \in[foo::chap2], \in[foo::chap3], \in[foo::chap4]

Remarks: \in[foo::remark1], \in[foo::remark2]

% any chapters and sections here

\stoptext

It is expected to have the same first page on these documents:

Equations: 1.1, 2.2, A.1, A.2
Sections: 2.1, 2.2, A.1, A.2
Chapters: 1, 2, A, B
Remarks: A.2.1, A.2.2

However, the bar.tex produces wrong prefixes to formulas and remarks. The
output depends on the document structure of bar.tex, not foo.tex.

I started looking into the source code. Thanks to lua, it is not a big deal
to track the problem. The prefixdata is complemented by the sectiondata
after the loading the tuc file. So, the question is: is it possible to
store the full prefixdata with all necessary prefix numbers in the tuc
file? Here is my proposal to change the source code:

--- strc-lst-old.lmt2023-01-29 11:30:15.610309948 +0300
+++ strc-lst.lmt2023-01-29 12:10:08.864228923 +0300
@@ -266,6 +266,16 @@
 if r and not r.section then
 r.section = structures.sections.currentid()
 end
+-- store sectiondata in prefixdata (necessary for external files)
+if t.prefixdata and r.section then
+local sectiondata = structures.sections.collected[r.section]
+if sectiondata then
+for k, v in next, sectiondata do
+t.prefixdata[k] = v
+end
+end
+end
+--
 local b = r and t.block
 if r and not b then
 local s = r.section

--- strc-ref-old.lmt2023-01-29 11:30:15.823643904 +0300
+++ strc-ref.lmt2023-01-29 12:07:45.697109862 +0300
@@ -2318,7 +2318,17 @@
 if data then
 numberdata = lists.reordered(data) -- data.numberdata
 if numberdata then
-helpers.prefix(data,prefixspec)
+-- helpers.prefix(data,prefixspec)
+-- use the actual numbers from prefixdata
+local prefixdata = data.prefixdata
+if prefixdata then
+-- adapted from helpers.prefix (not sure)
+if (prefixspec and prefixspec == no) or prefixdata.prefix
== no then
+prefixdata = false
+end
+sections.typesetnumber(prefixdata,"prefix", prefixspec or
false, prefixdata)
+end
+--

 sections.typesetnumber(numberdata,"number",numberspec,numberdata)
 else
 local useddata = data.useddata

After this small change, all the references are correct. However, I'm quite
new to ConTeXt, so maybe here are some caveats. It would be great to fix
the references to formulas, especially for the forthcoming