Re: [NTG-context] Set up external figure for particular image type

2022-07-12 Thread Albert Krewinkel via ntg-context

Thangalin via ntg-context  writes:

> The source comes from Markdown, which is converted to XML, then typeset
> using ConTeXt. There's no Markdown-specific mechanism to relate images
> to a particular external figure definition, unfortunately. All images
> use the same syntax and are treated the same way. The only part that
> differs is the file name extension (and header within the file).

The below is likely overkill and a good bit of work to setup, but it is
also very flexible. Maybe it suits your needs.

The Markdown-to-XML conversion can be tuned to include all the relevant
information. E.g., you could use pandoc with a custom writer to produce
the XML format of your choice. The link below is an example XML writer
that can be tuned as needed.


With that setup, one can modify the `Image` function to produce the
output you need. E.g., match on the file name extension use the library
function `pandoc.path.split_extension` and then change the element type
depending on the extension.

This way you'd have all the important information in your XML.
More info:  and
.

Of course, you could also use pandoc to go directly to ConTeXt; that is
currently my preferred way of producing PDF from Markdown.

Cheers,
Albert

-- 
Albert Krewinkel
GPG: 8eed e3e2 e8c5 6f18 81fe  e836 388d c0b2 1f63 1124
___
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] Bug in placeformula

2022-07-12 Thread Mikael Sundqvist via ntg-context
On Tue, Jul 12, 2022 at 6:34 PM Otared Kavian via ntg-context
 wrote:
>
> Dear Hans, dear Mikael,
>
> In my experiments with the new math engine, I noticed that there is an issue 
> with \placeformula when one sets the location of the numbers on the left: the 
> number is one line above the formula. Here is a minimal example:
>
> % begin bug-placeformula-left.tex
> \setupformulas[location=left]
>
> \starttext
>
> \placeformula
> \startformula
> a^2 + b^2 = c^2.
> \stopformula
>
> \stoptext
> % end bug-placeformula-left.tex
>
> Moreover, in some environments (such as enumerations) the bug destroys 
> completely the flow of text but I could not set up a minimal example to send 
> you.
>
> Best regards: Otared

Thanks for reporting! We must have missed this one while testing. It
should be fixed.

If you for the moment can live without splitting, then this seems to
give you the formula number where expected:

\placeformula
\startformula[location=left,split=no,numberlocation=overlay]
a^2 + b^2 = c^2.
\stopformula

(or put the keys in \setupformula)

I hope it helps.

/Mikael
___
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] fullhz, kerning and glue

2022-07-12 Thread Hans Hagen via ntg-context

On 7/12/2022 9:42 PM, Henning Hraban Ramm via ntg-context wrote:


And "fullhz" in spac-ali.mkxl calls \font_expansion_enable_k.

So, apparently fullhz enables stretching of *kerning* – that sounds to 
me like letterspacing.

no, it's the inter-character kerning (the tiny thingies)

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
___


[NTG-context] french quotation marks

2022-07-12 Thread Henning Hraban Ramm via ntg-context
Hi, according to my knowledge (and also Wikipedia), French uses « … » as 
double (\quotation) and ‹ … › as single (\quote) quotation marks.


The current setting in ConTeXt however is « … » for both, just with less 
spacing for \quote.

If no francophone user objects I’d suggest to fix this.

Hraban


\mainlanguage[fr]
\starttext
\quotation{\quote{Wikipédia} est un projet d’encyclopédie collective en 
ligne, universelle, multilingue et fonctionnant sur le principe du 
\quotation{wiki}.}

\stoptext
___
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] fullhz, kerning and glue

2022-07-12 Thread Henning Hraban Ramm via ntg-context

Hi,
I just added an explanation of "fullhz" to the options in 
https://wiki.contextgarden.net/Command/setupalign.

but I’m actually unsure if it’s right.

In the sources I found:
https://source.contextgarden.net/tex/context/base/mkxl/hand-ini.mkxl

%D At some point we can introduce extreme expansion, i.e. \type 
{\normaladjustspacing\plustwo}.

56
57% 0 = disabled
58% 1 = notused  (thesis)
59% 2 = glyph + kern
60% 3 = glyph only   (default)
61
62\def\font_expansion_enable  {\normaladjustspacing\plusthree}
63\def\font_expansion_enable_k{\normaladjustspacing\plustwo}
64%def\font_expansion_enable_n{\normaladjustspacing\plusone}
65\def\font_expansion_disable {\normaladjustspacing\zerocount}

And "fullhz" in spac-ali.mkxl calls \font_expansion_enable_k.

So, apparently fullhz enables stretching of *kerning* – that sounds to 
me like letterspacing.


OTOH in my notes (and thus in my book) I have the information that 
fullhz enables stretching of *glue*, and I thought that would mean 
whitespace outside of words.


Please enlighten me?

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] Set up external figure for particular image type

2022-07-12 Thread Rik Kabel via ntg-context


On 2022-07-12 14:11, Thangalin via ntg-context wrote:

Thank you for the suggestion Hraban.

The source comes from Markdown, which is converted to XML, then 
typeset using ConTeXt. There's no Markdown-specific mechanism to 
relate images to a particular external figure definition, 
unfortunately. All images use the same syntax and are treated the same 
way. The only part that differs is the file name extension (and header 
within the file).


One possibility would be something like:
|\setupexternalfigure[ width=1em, height=1em, order={svg,pdf,png,jpg}, 
location={local,default,global}, ] \defineexternalfigure[png][ 
width=\textwidth, height=\textheight, ] \unprotect 
\let\old_externalfigure=\externalfigure 
\tolerant\def\externalfigure[#1]#,[#2]#,[#3]{% 
\doifelseinstring{.png}{#1}{% \old_externalfigure[#1][png][#2]% }{% 
\doifelsefileexists{#1.png}{% \old_externalfigure[#1.png][png][#2]% 
}{% \old_externalfigure[#1][#2][#3]% }% }% } \protect |

See: https://tex.stackexchange.com/a/650221/2148

I was wondering if there was a simpler or a solution that's more the 
ConTeXt-way?


Thanks again!


Assuming that Pandoc markdown is being used, you should be able to set 
class attributes on each image. You can then associate external figure 
definitions with specific classes, and process each individually. 
(Pandoc user guide, link_attributes 
)


--
Rik

___
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] Set up external figure for particular image type

2022-07-12 Thread Wolfgang Schuster via ntg-context

Thangalin via ntg-context schrieb am 12.07.2022 um 20:11:

Thank you for the suggestion Hraban.

The source comes from Markdown, which is converted to XML, then 
typeset using ConTeXt. There's no Markdown-specific mechanism to 
relate images to a particular external figure definition, 
unfortunately. All images use the same syntax and are treated the same 
way. The only part that differs is the file name extension (and header 
within the file).


One possibility would be something like:
|\setupexternalfigure[ width=1em, height=1em, order={svg,pdf,png,jpg}, 
location={local,default,global}, ] \defineexternalfigure[png][ 
width=\textwidth, height=\textheight, ] \unprotect 
\let\old_externalfigure=\externalfigure 
\tolerant\def\externalfigure[#1]#,[#2]#,[#3]{% 
\doifelseinstring{.png}{#1}{% \old_externalfigure[#1][png][#2]% }{% 
\doifelsefileexists{#1.png}{% \old_externalfigure[#1.png][png][#2]% 
}{% \old_externalfigure[#1][#2][#3]% }% }% } \protect |

See: https://tex.stackexchange.com/a/650221/2148

I was wondering if there was a simpler or a solution that's more the 
ConTeXt-way?


When you use XML as input you can add additional code to the setups block
which uses \externalfigure to load the image.


\setupexternalfigures [location={local,global,default}]

\defineexternalfigure [jpg] [width=4cm]
\defineexternalfigure [png] [width=8cm]

\starttexdefinition includegraphics #1

    \splitfilename{#1}

    \processaction
    [\splitofftype]
    [    jpg=>{\externalfigure[#1][jpg]},
 png=>{\externalfigure[#1][png]},
 default=>{\externalfigure[#1]},
 unknown=>{\externalfigure[#1]}]

\stoptexdefinition

%\starttexdefinition includegraphics #1
%
%    \getfiguredimensions[#1]
%
%    \processaction
%    [\figurefiletype]
%    [    jpg=>{\externalfigure[#1][jpg]},
% png=>{\externalfigure[#1][png]},
% default=>{\externalfigure[#1]},
% unknown=>{\externalfigure[#1]}]
%
%\stoptexdefinition

\starttext

\includegraphics{hacker.jpg}

\includegraphics{mill.png}

\includegraphics{cow.pdf}

\stoptext

Wolfgang

___
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] Set up external figure for particular image type

2022-07-12 Thread Thangalin via ntg-context
Thank you for the suggestion Hraban.

The source comes from Markdown, which is converted to XML, then typeset
using ConTeXt. There's no Markdown-specific mechanism to relate images to a
particular external figure definition, unfortunately. All images use the
same syntax and are treated the same way. The only part that differs is the
file name extension (and header within the file).

One possibility would be something like:

\setupexternalfigure[
width=1em,
height=1em,
order={svg,pdf,png,jpg},
location={local,default,global},
]
\defineexternalfigure[png][
width=\textwidth,
height=\textheight,
]
\unprotect
\let\old_externalfigure=\externalfigure
\tolerant\def\externalfigure[#1]#,[#2]#,[#3]{%
\doifelseinstring{.png}{#1}{%
\old_externalfigure[#1][png][#2]%
}{%
\doifelsefileexists{#1.png}{%
\old_externalfigure[#1.png][png][#2]%
}{%
\old_externalfigure[#1][#2][#3]%
}%
}%
}\protect

See: https://tex.stackexchange.com/a/650221/2148

I was wondering if there was a simpler or a solution that's more the
ConTeXt-way?

Thanks again!
___
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] Bug in placeformula

2022-07-12 Thread Otared Kavian via ntg-context
Dear Hans, dear Mikael,

In my experiments with the new math engine, I noticed that there is an issue 
with \placeformula when one sets the location of the numbers on the left: the 
number is one line above the formula. Here is a minimal example:

% begin bug-placeformula-left.tex
\setupformulas[location=left]

\starttext

\placeformula
\startformula
a^2 + b^2 = c^2.
\stopformula

\stoptext
% end bug-placeformula-left.tex

Moreover, in some environments (such as enumerations) the bug destroys 
completely the flow of text but I could not set up a minimal example to send 
you.

Best regards: Otared


___
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] LMTX and modules

2022-07-12 Thread Axel Kielhorn via ntg-context
Hello,

Some years ago I wrote an introduction to ConTeXt in German:

https://github.com/AKielhorn/Context-Intro

But that was long ago.

Today LMTX is state of the art and I tried to build it with a recent LMTX.

This lead to problems because LMTX does not include modules.

Therefore my question is:
Is the a plan to include modules into the regular LMTX installation?

If not, is there a way to test for a certain module?

\doiffileexists{m-module}
\usemodule{module}

Greetings
Axel
___
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
___