[NTG-context] Table of contents in the middle of a document

2023-04-17 Thread Kalouguine Andre via ntg-context
Hi, 

I was trying to have my "Acknowledgements" section/chapter before the
table of contents but be contained within it. 

Is it normal that the table of contents is empty if there is a chapter
that begins before it? 

``` 

\starttext
\chapter{Acknowledgements}
Thank you

\completecontent

\chapter{Intro}

\chapter{Problem}

\chapter{Solution}
\stoptext 

``` 

I'm mostly looking for an explanation rather than a direct solution, I'd
like to understand why it's empty. It works when using sections instead
of chapters. 

Best regards,

-- 
Kalouguine 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
___


Re: [NTG-context] Using project-local fonts

2023-04-13 Thread Kalouguine Andre via ntg-context
On 13.04.2023 21:22, Rik Kabel via ntg-context wrote:

> EB Garamond is hopelessly broken with respect to hlig and dlig, and has been 
> for quite a while. 
> 
> I reported the problem 
> (https://github.com/octaviopardo/EBGaramond12/issues/20) over five years ago, 
> and the maintainer (if there is one) has done nothing. See also #4 in that 
> issues list (https://github.com/octaviopardo/EBGaramond12/issues/4). There 
> are a couple of forks, but there is no established reference implementation 
> that I can see. The Google Fonts implementation is similarly challenged, 
> perhaps worse.

Oh, I hadn't realized. I had read somewhere that the TeXlive version was
simply older than the `Specimen.pdf` document and had some bugs. I
hadn't realized that it wasn't fixed yet.
This is unfortunate! 

Thanks for the information, you saved me from wasting too much time on
that. 

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
___


Re: [NTG-context] Using project-local fonts

2023-04-13 Thread Kalouguine Andre via ntg-context
Hi,

> i'm not familiar with that approach so can't see what interferes

The most important change is that I can't update it and I can't put
stuff in the system directory nor the user one. 
So I only have access to the project folder, it has to be
self-contained. 

> \definefontfamily [ebgaramond] [serif] [ebgaramond] 
> [features=eb-garamond-normal]

Apologies, my fault, I forgot a part of my email. I don't want the c-t
and s-t ligatures (supposed to be in `hlig`). But I do want the T-h
ligature which is supposed to be in `dlig`. So as far as I understand,
TeXlive comes with an old version of EB Garamond in which all of them
are in `dlig`. Hence my question about self-contained projects with
fonts. 

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] Using project-local fonts

2023-04-13 Thread Kalouguine Andre via ntg-context
Hi, 

I'm writing a small report using EB Garamond as the main font. I am
sometimes using Overleaf (which has a ConTeXt distribution that is
accessible using a latexmkrc file). 

The problem is, the EB Garamond version that is included seems to have a
bug: the c-t and s-t ligatures (and maybe others) are triggered when
enabling `dlig` even though they are supposed to be in the `hlig`
feature. I also would like to include the Hack font that isn't in the
distribution.
So, I'm looking for a way to embed the fonts into the project in a
portable way instead of installing them in a system directory. Is there
any way to do so ? The version of ConTeXt used is

ConTeXt  ver: 2021.03.05 19:11 MKIV  fmt: 2023.4.13  int:
english/english

Here is a small MWE: 

output.tex``` 

\definefontfeature
[myfontfeature]
[default][
liga=yes,
tlig=yes,
dlig=yes,
hlig=no,
]

\definefontfamily [ebgaramond] [serif] [ebgaramond]
[features=myfontfeature]
\definefontfamily [ebgaramond] [math]  [Garamond-Math]
\definefontfamily [ebgaramond] [mono]  [Hack] [tf = style:mono]
\setupbodyfont[ebgaramond,12pt]

\starttext
The most distict sentence. 
\stoptext 

``` 

latexmkrc``` 

 $latex = 'ls /;context --luatex --synctex --batchmode %S' 

```

-- 
Kalouguine 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
___


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
___


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

2023-01-28 Thread Kalouguine Andre via ntg-context
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 
of copiable spaces in verbatim mode. 
Thanks again! 
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
___


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

2023-01-28 Thread Kalouguine Andre via ntg-context
Hi Pablo,

> \showframe
> \setupinteraction[state=start]
> \starttext
> \startbuffer[abc]
> def foo(x):
> if x == 0:
> bar()
> else:
> baz(x)
> foo(x - 1)
> \stopbuffer
> \comment[location=leftmargin,
> space=yes,
> buffer=abc,
> title={Python code}]
> {}\typebuffer[abc]
> \stoptext
> 
> This might solve what you need. At least, this is the approach that I
> use to provide text that can be directly copied.
> 
> I'm on Linux and last time I tested on Windows there were extra lines in
> the comments.

That's actually something I had never thought of, using PDF comments,
thanks!. 
It's a really nice approach, though weirdly it doesn't work on Okular
(Linux+KDE) 
for me, even though attachments worked fine. I'll try and see why that
is. 

What I had in mind was rather the following: 

\starttext 
\starttyping[space=on] 
def foo(x):
y = bar(x) 
if y: 
return x 
return y 
foo(1) 
\stoptyping 
\stoptext

but with ordinary char32 spaces rather than \textcontrolspace
characters. 

Best regards,___
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] Subject: Leading spaces verbatim

2023-01-27 Thread Kalouguine Andre via ntg-context
Good day to everyone, 

I'm trying to make a verbatim block of text with copiable leading spaces
so that students can just copy my Python code snippets into their IDE. I
believe the question has been asked before (though I confess I can't
find the right search terms to find the answer again). I get that PDFs
are not the optimal way to give code to students (which is why for
longer snippets, I just give them the files or I attach them into the
PDF), but for short snippets it would be so much simpler... 

I recently stumbled onto this article:
https://www.overleaf.com/latex/examples/using-luatex-to-convert-interword-glue-to-spaces-and-kerns/sfdkdkybrvkv
wherein the author replaces the TeX glue with spaces and kerning. I was
wondering whether the same idea could be applied within the typing
environment but making a primitive verbatim environment using \obeylines
and \obeyspaces did not result in copiable spaces. 

Unfortunately, whilst I have some concepts of how luatex works on the
input file, the step wherein a pdf is formed is fairly misterious to me,
meaning I can't really understand the Lua code from said article
(https://gist.github.com/Semptum/076cca71bc251ebe19ff96c5effca3cb). 

Hence, my three questions: 

 - Is it even realistic to make such a typing environment?
 - What would be the best path to do so?
 - Can someone recommend some reading material specifically about this
kind of typographical adjustments using LuaTex? Stuff like adjusting the
glyphs's position, replacing characters with combined characters etc...
Sorry if that's a bit vague, as you can see from the rest of the
message, I never really went too deep into the later stages of the TeX
pipeline. 

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
___