[NTG-context] Indentation in headings

2024-09-14 Thread Kirill Davidov
Greetings,

As per Russian GOST standards, numbered section headings are flush left
and start with the paragraph indent. Is there a proper way to indent a
section heading? The code simulates what I want visually, but it
unfortunately causes the heading to poke out into the margins. That can
be troublesome if the title is long enough.

Example code to tinker with:

\setupindenting[yes, 2.5em, first]
\setuphead[section][
    style=\bf,
    align=flushleft,
    distance=1em,
    indentnext=yes,
]

\showframe

\startdocument

\startsection[title=Foo]

\input dijkstra

\stopsection

\startsection[title=Very long section title that makes you question the
author's writing capabilities]

\input dijkstra

\stopsection

\setuphead[section][
    style=\bf,
    align=flushleft,
    distance=1em,
    indentnext=yes,
    before=\blank[2*big]\indentation,
]

\startsection[title=Foo]

\input dijkstra

\stopsection

\startsection[title=Very long section title that makes you question the
author's writing capabilities]

\input dijkstra

\stopsection

\stopdocument

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Indentation in headings

2024-09-14 Thread Wolfgang Schuster

Kirill Davidov schrieb am 14.09.2024 um 08:59:

Greetings,

As per Russian GOST standards, numbered section headings are flush left
and start with the paragraph indent. Is there a proper way to indent a
section heading? The code simulates what I want visually, but it
unfortunately causes the heading to poke out into the margins. That can
be troublesome if the title is long enough.

Example code to tinker with:

[...]



You have to use the narrow environment and apply it with the beforehead 
and afterhead command and in addition enable the aligntitle option.


 begin example
\setupindenting
  [yes, 2.5em, first]

\setuphead
  [section]
  [
 align=flushleft,
 beforehead={\startnarrow[left=\parindent][left]},
 afterhead=\stopnarrow,
 aligntitle=yes,
 indentnext=yes,
   ]

\showframe

\startdocument

\startsection[title=Very long section title that makes you question the 
author's writing capabilities]


\input dijkstra

\stopsection

\stopdocument
 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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Indentation in headings

2024-09-14 Thread Kirill Davidov
On 9/14/24 12:41, Wolfgang Schuster wrote:

> You have to use the narrow environment and apply it with the
> beforehead and afterhead command and in addition enable the aligntitle
> option.
>
> Wolfgang
Yeah, that does seem to work. Thanks!
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Validation of pdf/A-2a

2024-09-14 Thread Thomas Meyer

Hello Hans,

thanks for the detailed answer.  Now it works!

I didn't realise until now that pdf is also messy. In my job I have 
enough to do with the fact that some products never work as they should 
("Mr Gates has won and now we have to use his products.’ - said our 
former head of IT). I have nothing to do with IT, I am a scientist.


I am grateful for LaTeX, and of course I thank you, Hans, for ConTeXt!

I can only emphasise that I am just a user who keeps turning to lists 
for support.


Thank you for your time and patience.

Have a nice weekend
Thomas


Am 13.09.24 um 11:59 schrieb Hans Hagen via ntg-context:

On 9/13/2024 9:51 AM, Thomas Meyer wrote:
Oh, I'm afraid that my “I hope for the future.” has now led to a 
misunderstanding.


I would like to archive my documents as pdf/A-2a. As a reference to 
the German Bundesarchiv, which recommends pdf/A-2a in the first 
instance - and pdf/A-2u in the second.


I simply noticed that, as described in my initial email, the pdf/A-1a 
and pdf/A-2a variants do not pass the validation test with verapdf.


Since there seems to be no way around this, I will probably have to 
fall back on the second recommendation.


You cna try this:

\setupinteraction
  [title=TITLE,
   subtitle=SUBTITLE,
   author=AUTHOR,
   keyword={{KEYWORD1, KEYWORD2}, KEYWORD3}]

\setupbackend
  [format={pdf/a-2a},
   profile={default_cmyk.icc,default_rgb.icc,default_gray.icc}]

\setuptagging
  [state=start]

\enabledirectives
  [backend.usetags=mkiv]

\starttext

    \chapter[chap:testing]{Testing}

    \input knuth

    \input tufte

\stoptext

This validates in the verapdf that i have installed (1.25.271).

So, you choose some standard (which we try to accomodate as good as 
possible but who knows ... this one is a bloated one due to the icc 
profiles). As you want tags we enable that (no need for it as long as 
one is not finished with the document unless one wants to trace). We 
also load the the old school mkiv mapping.


You can define your own mappings if needed. After looking into the 
latest greatest volatile specifications Mikael and I decided that we 
don't want to be waste too much time on it (at least not now as we hav 
emore interestign thinsg to work on) and settled for what validates 
and let users themselves decide. We mostly aim(ed) at making the 
university enforced tools happy.


Structure in pdf is (to put it mildly) a mess, insufficient and never 
will be (conceptually) okay, which is probably why it keeps being 
adapted to what some applications can support or not. We don't want to 
cripple what structure in ConTeXt we have. For the long time 
accessibility tagging (there are other kinds of tagging being in use) 
has been around for a quite vwhile now it has been the domain of 
acrobat professional toolkit so in a broader context it is kind of 
useless anyeay.


(One can wonder what organizations demanding it really have in mind, 
given that older stuff doesn't validate and probably no one ever 
checked how useful it is. But that's often the case with standrads 
like this: some checkbox ticks so we're okay.)


So, the best we can do is to provide some flexibility, as usual in tex 
tools,


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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net 
(mirror)

archive  : https://github.com/contextgarden/context
wiki : https://wiki.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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Validation of pdf/A-2a

2024-09-14 Thread Hans Hagen

On 9/14/2024 10:14 AM, Thomas Meyer wrote:

I can only emphasise that I am just a user who keeps turning to lists 
for support.


Which is what the list is for, so okay,

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://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: ConTeXt LMTX 2024, \setupalign: Is the "Nicer justification and microtypography" list of options listed in ConTeXt Garden now obselete?

2024-09-14 Thread Wolfgang Schuster

Felix schrieb am 14.09.2024 um 06:13:

When I try to use a combination (example =
\setupalign[normal,extremestretch,verytolerant,hangingboth,fullhz,hyphenated,]
)

and just normal

I seem to be getting the same result when I try to load in a big paragraph. 
However, there is an obvious difference between me entering (just) flushleft, 
normal, flushright.

Have those options become obsolete? how am I supposed to know?


Whether there is a difference or not depends on your text, when you have 
a wide

text block and short words TeX can produce good results without the need for
additional parameters but when you have a narrow text blocks (e.g. for 
text in

columns) or long words you need additional settings.

The example below shows how different options can result in different 
line breaks
but not all sample text produce the same effect, sometimes you get the 
same result

with and without verytolerant etc.

Don't forget to enable expansion and protrusion before you use the 
hanging and hz

options because they need these font features.

 begin example
\definefontfeature [default] [default] 
[expansion=quality,protrusion=quality]


\setuppapersize [A5]

\defineframed
  [Example]
  [width=max,
   offset=none,
   framecolor=lightgray]

\starttext

\startprocesscommalist[normal,{normal,verytolerant},{normal,stretch},{normal,hanging},{normal,hz}]
  \starttitle[title=\currentcommalistitem]
    \startframed[Example][align=\currentcommalistitem]
    \samplefile{tufte}
    \stopframed
  \stoptitle
\stopprocesscommalist

\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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: (ConTeXt LMTX 2024, monospace font) Why does monospaced text go out of the margin for me? is this supposed to happen?

2024-09-14 Thread Wolfgang Schuster

Felix schrieb am 14.09.2024 um 06:40:

https://pastebin.com/2ce1xSYf

The code linked above has 3 paragraphs. One in TImes New Roman, the other in 
Aptos and the last in Aptos Mono.

The paragraph with \tt seems to go over my margin of .5 inches for the left and 
right side of my doc., but the serif and sans serif text doesn't. I can't seem 
to figure out why exactly this is.

Did I set up \setuplayout incorrectly? I wanted .5in margins but I kind of 
'hacked' the way I got things. Is there a better way that I could have gotten 
.5 inch margins and a.5in header/footer? I can't seem to understand why the 
output is what it is. I would greatly appreciate any help!

Feel free to switch out the fonts if you'd like


You're trying to justify a text with a fixed width font which fails 
because the often have a fixed width space. When you have a space a 
fixed width TeX can stretch or shrink the space between the word to 
align them with the right margin.


The best solution is to disable justification and use ragged text on the 
right side. An alternative is to allow bigger spaces between words but 
as you can see in the following example the gaps between words can be 
quite large.


 begin example
\showframe

\setupbodyfont[tt]

\starttext

\samplefile{zapf}

\blank

\start \setuptolerance[space]
\samplefile{zapf}
\par \stop

\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 / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Unexpected behaviour of apa-bibliography

2024-09-14 Thread M U via ntg-context
I do not know anything about the apa-standard, so I do not know if my rendering 
follows the standard. 

The first appearance of the author in the bibliography is marked with year-b 
(1847b), the second with year-a (1847a). I expected the first to be marked with 
year-a and the second with year-b.

Citing multiple references in one \cite[] only 2 out of 3 righttexts appear. 
When using 
\setupbtx[apa:cite][sorttype=none] 
all 3 righttexts appear but the characters after the year disappear.

Is there a way to fix that behaviour?

Thank you. Have a nice weekend.
Matthias

\startbuffer[bibliography]
@book{spratt_Travels2_1847,
title = {Travels},
volume = {2},
publisher = {Voorst},
author = {Spratt and Forbes},
year = {1847},
}
@book{spratt_Travels1_1847,
title = {Travels},
volume = {1},
publisher = {Voorst},
author = {Spratt and Forbes},
year = {1847},
}
@book{test,
title = {Title-Test},
publisher = {Publisher-Test},
author = {Author-Test},
year = {2000},
}
\stopbuffer

\definebtxdataset[asia] 
\usebtxdataset[asia][bibliography.buffer]

\setupbtx[
  dataset=asia, 
  specification=apa,
  ] 

\usebtxdefinitions[apa] 

\setupbtxrendering[asia][
  dataset=asia, 
  sorttype=authoryear, 
  ]

% \setupbtx[apa:cite][sorttype=none]

\starttext
single citing:\\
\cite[righttext={{text 1: Vol. 1}}][spratt_Travels1_1847] \\
\cite[righttext={{text 2: Vol. 2}}][spratt_Travels2_1847]\\ 
\cite[righttext={{text 3: Test}}][test]

multiple citing:\\
\cite[righttext={{text 1: Vol. 1},{text 2: Vol. 2},{text 3: 
Test}}][spratt_Travels1_1847,spratt_Travels2_1847,test]

\blank[2*line]
\placebtxrendering[asia][method=global]

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Margins using 2UP imposition schema

2024-09-14 Thread Angel M Alganza

Hello:

I'm composing an A5 booklet printed on an A4 paper using the 2UP 
imposition schema.  I believe, in such case, margins should be 
controlled using 'backspace' and 'cutspace' options of the \setuplayout 
command, but I'm afraid I don't quite understand how to use those 
properl.  I want to make the 'external' margin (right on odd pages and 
left on even pages) as small as possible, and the 'internal' margin 
larger, so that I can hole punch the booklet.


I believe, in such case, margins should be controlled using 'backspace' 
and 'cutspace' options of the \setuplayout command, but I'm afraid I 
don't quite understand how to use those properly.  Here's a minimal 
example:


\setuppapersize[A5][A4]
\setuparranging[2UP,rotated]
\setuplayout
[topspace=13pt,
backspace=30pt,
cutspace=-20pt,
width=fit,
height=fit,
header=0pt,
footer=0pt]
\setuppagenumbering[state=stop]
\setupbodyfont[small]
\starttext
\dorecurse{20}{\input tufte \vskip 1em}
\stoptext

I wonder how I could reduce the left margin and increase the left one on 
the even pages.


Any pointers, please?

Thank you so much in advance.
Ángel
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Calling C code from ConTeXt LMTX

2024-09-14 Thread Florent Michel
Hello,

TL;DR: Could building LuaMetaTeX with the `-fPIC` flag for the Lua library
have negative consequences? Is there a better way to be able to call
external C functions from ConTeXt?

I am working on a small project where it would be convenient to call
functions written in C (possibly pre-compiled in a shared library) from
ConTeXt. After looking at the Lua FFI, I found a way that seems to work
(with ConTeXt LMTX 2024-08-16) but requires a small tweak to the cmake file
used for building the Lua library. I would be grateful to have the opinion
of people more knowledgeable than I am about whether this change could have
negative consequences and whether there is a more straightforward way to
call external C code.

What I am trying to achieve is:
* Compile some C code in a shared library (for instance, it may contain a
numerical solver for some partial differential equation).
* Have this code run when compiling a document with ConTeXt. (For instance,
solving the differential equation with parameters defined in the .tex file
and retrieving the results to plot a figure with MetaPost.)

One easy way to do that is:
* Write wrappers for the functions that will need to be called from ConTeXt
using the Lua C API.
* Compile the code and wrappers in a shared library and linking to the
static lua library used by LuaMetaTeX (liblua.a on Linux).
* In the .tex file, import the new library using, e.g.,
```
\startluacode
mylib = require("mylib")
-- additional code using the C functions
\stopluacode
```
* Run ConTeXt with the `--permitloadlib` flag.

However, the second step requires (at least on Linux) liblua.a to be
compiled with the `-fPIC` flag. I could do that by adding
```
set_property(TARGET lua PROPERTY POSITION_INDEPENDENT_CODE ON)
```
at line 47 in lua.cmake. Is there any known negative effect of doing that
(apart from a possible small performance drop)?
(Just to be clear, this is not a feature request; I'm just wondering
whether doing it on my side is fine.)

On a related note, is there a standard way to call external C functions
(either in a shared library or in a .c file) from ConTeXt LMTX? The SwigLib
library described in
https://www.pragma-ade.nl/general/manuals/swiglib-mkiv.pdf looks very
promising (and maybe could be a way to achieve what I'm trying to do in a
much cleaner way), but I (maybe for lack of trying hard enough) have not
been able to make it work with ConTeXt LMTX so far.

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___


[NTG-context] Re: Margins using 2UP imposition schema

2024-09-14 Thread Thomas A. Schmitz

On 9/14/24 19:08, Angel M Alganza wrote:
I wonder how I could reduce the left margin and increase the left one on 
the even pages.


Any pointers, please?

Thank you so much in advance.
Ángel


You need to tell ConTeXt that you want to have a doublesided layout. 
This is achieved with


\setuppagenumbering [alternative=doublesided]

You can (and should) read about it in the wiki: 
https://wiki.contextgarden.net/Page_Layout#Defining_the_layout


Best

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

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___