ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] Thesis in ConTeXt
@ 2025-04-10 22:36 Gerion Entrup
  2025-04-11  0:33 ` [NTG-context] " Max Chernoff via ntg-context
  0 siblings, 1 reply; 3+ messages in thread
From: Gerion Entrup @ 2025-04-10 22:36 UTC (permalink / raw)
  To: ntg-context


[-- Attachment #1.1.1: Type: text/plain, Size: 5294 bytes --]

Hi,

I just published my PhD thesis in ConTeXt (with graphics in LaTeX/TikZ) [1].
For a lot of typesetting tasks I got great help here.
Thank you for making ConTeXt and thank you for helping me here!

I published the source code here [2] to maybe give something back.
For this community, probably the most interesting part are the data and acronyms "modules".

## Data
For scientific papers, often you need to embed some measurement data. The simple approach here is to let some programs produce the data and then just copy them data for data into the text.
This, however, is a really tedious and error-prone task when you do it multiple times.
Thus, a colleague of mine develops versuchung [3] and dataref [4].
The first one is a Python library to output measurement data in a defined format and the latter is a LaTeX/PGF library to embed that data referenced by its key into a LaTeX document.

For ConTeXt, this was not possible. Therefore, Versuchung is now able to directly output lua tables and "data.lua" [5] provides minimal tooling to read that data in a ConTeXt document.
The idea is to have a function "get_experiment" to get all data of a specific experiment. The function returns another function that allows to give a specific string (the keys in the Lua table) to get the actual data.
The meaning of returning another function is to be able to track all usages of the data (for example one can generate a datagraphy with this).
Example usages are here [6] and here [7].

## Acronyms
I wrote the thesis in German but had the problem that a lot of computer science acronyms are in English. I therefore decided to use either the German long version (correctly declined) or the English acronym. However, this should happen in an automated way (I want to always write down the acronym in the source code) and it should track that the acronym is _always_ fully described before using it.
This behavior is similar to the acronym package of LaTeX [8].
To simplify data transfer the logic and the acronyms are entirely in Lua and I just provided an interface for ConTeXt/TeX.
The acronym logic is here [9], the TeX interface here [10]. It provides mainly the \acr command with a few arguments:
\acr[f, l, p, g, d, a, b]{my-acronym}
- f (full) to get the full acronym: acronym in long form in German, English long form and acronym
- l (long) to get the acronym written out
- p (plural) to get the plural form
- g (genitive) to get the genitive form
- d (dative) to get the dative form
- a (accusative) to get the accusative form
- b (bestimmt) to get the definite form (indefinite otherwise)

A test document is also provided [11] (I attached the generated PDF for that document).
This is _not_ generically usable. It works for the acronyms used in the thesis. I had a hard time figure out patterns for endings in German (I'm not a linguist) and basically provide exactly the patterns for the acronyms in the thesis. It may be useful anyway.

## General experience with ConTeXt so far
I used LaTeX a lot, I've written my master's and PhD thesis in ConTeXt now. Recently, I also experimented with Typst.
In general, I find ConTeXt way more consistent than LaTeX. I really like the key value interface for most functions. It also feels like (and is) a complete system (not like LaTeX as a system consisting of _a lot of_ different modules, most of them playing together just most of the times).
I find Lua way easier to use as TeX as a programming language, therefore I prefer writing everything that contains programming logic in Lua. AFAIK, this aligns with ConTeXt. BTW, does a public Lua interface of ConTeXt exist with a reference what ConTeXt specific functions can be called directly in Lua?
I find the ConTeXt source code hard to read. I dug around in the source code for typesetting references to personalize them and needed time to find the files that are responsible for this and understand the relevant variable and function names therein. When searching (grep) for a command, I often got some really long lists of commands containing the one I searched for, but I had a hard time finding the TeX and Lua code that implemented that specific command.
I also needed some time to find out that manuals exist for most parts (first source for information was the wiki). When I found them, though, they were really helpful, especially for more low level knowledge (and as code examples).
The context command line program is way better than the ones LaTeX provides (something like latexmk for example is simply not needed).
Also, ConTeXt is way faster than LaTeX (though much slower than Typst but AFAIK, Typst is not as complete as ConTeXt).

Best,
Gerion

[1] https://repo.uni-hannover.de/handle/123456789/18862
[2] https://codeberg.org/gerion/phd
[3] https://github.com/stettberger/versuchung
[4] https://www.ctan.org/pkg/dataref
[5] https://codeberg.org/gerion/phd/src/branch/main/data.lua
[6] https://codeberg.org/gerion/phd/src/branch/main/diss-style.tex#L620
[7] https://codeberg.org/gerion/phd/src/branch/main/cha/08-os-modell.tex#L283
[8] https://www.ctan.org/pkg/acronym
[9] https://codeberg.org/gerion/phd/src/branch/main/acronyms.lua
[10] https://codeberg.org/gerion/phd/src/branch/main/diss-style.tex#L564
[11] https://codeberg.org/gerion/phd/src/branch/main/acronymtest.tex

[-- Attachment #1.1.2: acronymtest.pdf --]
[-- Type: application/pdf, Size: 19080 bytes --]

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [NTG-context] Re: Thesis in ConTeXt
  2025-04-10 22:36 [NTG-context] Thesis in ConTeXt Gerion Entrup
@ 2025-04-11  0:33 ` Max Chernoff via ntg-context
  2025-04-11  7:47   ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Max Chernoff via ntg-context @ 2025-04-11  0:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Max Chernoff

Hi Gerion,

On Fri, 2025-04-11 at 00:36 +0200, Gerion Entrup wrote:
> I just published my PhD thesis in ConTeXt (with graphics in LaTeX/TikZ)

> I published the source code here [2] to maybe give something back.

Wow, that looks great, thanks for sharing!

> In general, I find ConTeXt way more consistent than LaTeX. I really
> like the key value interface for most functions. It also feels like (and
> is) a complete system (not like LaTeX as a system consisting of _a lot
> of_ different modules, most of them playing together just most of the
> times).

Agreed.

> BTW, does a public Lua interface of ConTeXt exist with a reference
> what ConTeXt specific functions can be called directly in Lua?

"cld-mkiv.pdf" is the main manual, although there's lots not listed
there. Most of the newer manuals mention the Lua interfaces for their
specific topic, but they don't usually go into too much depth. Often,
you'll have to check the Wiki, check the mailing list archives, or refer
to the source.

> I find the ConTeXt source code hard to read. I dug around in the
> source code for typesetting references to personalize them and needed
> time to find the files that are responsible for this and understand the
> relevant variable and function names therein.

Yeah, I agree that it's not the easiest to read, but it's certainly
*far* better than LaTeX. And the newer code is usually pretty nice, so
it's often only the older code (or the code that does inherently complex
stuff, like for fonts) that's tricky. And you do get used to it after
awhile, although it took a couple years for me.

> When searching (grep) for a command, I often got some really long
> lists of commands containing the one I searched for, but I had a hard
> time finding the TeX and Lua code that implemented that specific
> command.

Most of the commands are just \def'ed, so searching for
"\def\yourmacroname" will often work. "\define" and "\let" are also
sometimes used. For the Lua-based commands, their names look like
\clf_yourmacroname and are defined by interfaces.implement, so you can
usually search for "name\s*=\s*['\"]yourmacroname['\"]"

You can also run

    mtxrun --script interface --meaning yourmacroname

although I admittedly never use that one myself.

> I also needed some time to find out that manuals exist for most parts
> (first source for information was the wiki). When I found them, though,
> they were really helpful, especially for more low level knowledge (and
> as code examples).

Yeah, some of the manuals are super obvious (like for math and metafun),
but others are rather hidden. Like, "cld-mkiv.pdf" is for Lua,
"details.pdf" is for grid snapping, etc. Some other good manuals to look
into are "onandon.pdf", "lowlevel.pdf", "ontarget.pdf", and
"evenmore.pdf".

(Also, what happened to "primitives.pdf"? That was one of my favourite
documents!)

> Also, ConTeXt is way faster than LaTeX

Yes, indeed, this is one of my favourite parts of ConTeXt.

> (though much slower than Typst but AFAIK, Typst is not as complete as ConTeXt).

Yeah, Typst is faster than pretty much anything, but they put in _a lot_
of work to get it that way, and it comes with quite a few limitations:

    https://www.researchgate.net/publication/364622490

Thanks
-- Max
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [NTG-context] Re: Thesis in ConTeXt
  2025-04-11  0:33 ` [NTG-context] " Max Chernoff via ntg-context
@ 2025-04-11  7:47   ` Hans Hagen
  0 siblings, 0 replies; 3+ messages in thread
From: Hans Hagen @ 2025-04-11  7:47 UTC (permalink / raw)
  To: ntg-context

On 4/11/2025 2:33 AM, Max Chernoff via ntg-context wrote:

> (Also, what happened to "primitives.pdf"? That was one of my favourite
> documents!)

that is now a chapter in luametatex.pdf

>> Also, ConTeXt is way faster than LaTeX
> 
> Yes, indeed, this is one of my favourite parts of ConTeXt.
> 
>> (though much slower than Typst but AFAIK, Typst is not as complete as ConTeXt).
 > > Yeah, Typst is faster than pretty much anything, but they put in _a 
lot_
> of work to get it that way, and it comes with quite a few limitations:
> 
>      https://www.researchgate.net/publication/364622490

in the end it all depends on functionality ... the more one supports and 
adds the slower ... the problem doesn't change (a simple macro package 
would also be very fast)

also, users have some influence too:

(1) check your style for bottlenecks
(2) make an example of what is slow and mention it on the list

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-04-11  7:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-10 22:36 [NTG-context] Thesis in ConTeXt Gerion Entrup
2025-04-11  0:33 ` [NTG-context] " Max Chernoff via ntg-context
2025-04-11  7:47   ` Hans Hagen

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).