[NTG-context] Re: tiffs: autoconversion via graphicsmagick produces invalid pdfs

2023-09-13 Thread denis.maier
Ok, I've found a solution.

%
\enabletrackers[graphics.conversion]

\startluacode
local function convert(oldname, newname)
os.execute(string.format(
'gm convert "%s" "%s"', oldname, newname)
)
end

-- Set the PDF, JPEG and default TIFF converters to the above function.
figures.converters.tif.pdf = convert
figures.converters.tif.jpg = convert
figures.converters.tif.default = convert
\stopluacode

\setfigureconversion[tif][jpg] % has no effect

\starttext

\externalfigure[test.tif][conversion=jpg]

\stoptext
%%%

Would it make sense to add
tifconverter.pdf = converter
to grph-con.lua (line 293) ?

Why is it that \setfigureconversion has no effect? Without conversion=jpg on 
\externalfigure, ConTeXt insists on converting to PDF. (I couldn't find the 
command in the sources, but I'm not getting a undef'ed cs error either, so it 
must be defined somewhere...)

I've also found out I can use a custom command that calls \externalfigure with 
the right settings depending on the filetype:

%%%
\enabletrackers[graphics.conversion]

\startluacode
local function convert(oldname, newname)
os.execute(string.format(
'gm convert "%s" "%s"', oldname, newname)
)
end

-- Set the PDF and default TIFF converters to the above function.
figures.converters.tif.pdf = convert
figures.converters.tif.jpg = convert
figures.converters.tif.default = convert
\stopluacode

\setfigureconversion[tif][jpg] % has no effect

\defineexternalfigure[tif][conversion=jpg]

\starttexdefinition includegraphics #1
  \splitfilename{#1}

  \processaction[\splitofftype][
tif=>{\externalfigure[#1][tif]},
default=>{\externalfigure[#1]},
unknown=>{\externalfigure[#1]}
  ]
\stoptexdefinition

\starttext

\includegraphics{test.tif} % will be converted to jpg

\externalfigure[test.tif] % will be converted to pdf

\stoptext


But I think it would be nicer to stick to the default \externalfigure.

Best,
Denis

Von: denis.ma...@unibe.ch 
Gesendet: Dienstag, 12. September 2023 17:09
An: ntg-context@ntg.nl
Betreff: [NTG-context] Re: tiffs: autoconversion via graphicsmagick produces 
invalid pdfs

Sorry, that was too quick...

Hi,

currently, ConTeXt can't use tiffs directly, but it uses Graphicsmagick to 
convert tiffs to pdf on the fly. However, as it seems, graphicsmagick is 
producing invalid pdfs.

For every included tiff I have something like this in the log:
luatex warning  > pdfe: invalid 11 0 R object at offset 573751
luatex warning  > pdfe: invalid 11 0 R object at offset 629127

The offsets are different, but it's always this .

This bug has been known for quite some time, but it apparently hasn't been 
fixed yet: https://sourceforge.net/p/graphicsmagick/bugs/513/

Converting the tiffs to jpeg circumvents the problem. Would it be an option to 
convert tiffs to jpegs instead of to pdf? (Is that already possible?)

Best,
Denis



Von: denis.ma...@unibe.ch 
mailto:denis.ma...@unibe.ch>>
Gesendet: Dienstag, 12. September 2023 17:03
An: ntg-context@ntg.nl
Betreff: [NTG-context] tiffs: autoconversion via graphicsmagick produces 
invalid pdfs

Hi,

currently, ConTeXt can't use tiffs directly, but it uses
___
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] My example, with \blackrule, works perfect

2023-09-13 Thread Ursula Hermann
Dear List,
I just finished my example, did some changes today and it works perfect
\setuppapersize[A8,landscape]
\setuplayout[leftmargin=2.5cm,
 leftmargindistance=0.2cm,
 backspace=2.9cm,
 width=4cm]
\margintext{\blackrule[color=black, height=0.05ex, 
width=1cm]\\}\blackrule[color=black, height=0.05ex, width=4cm]
\starttext
\margintext{2.1.1}\
{Ach ist das schön, dass du da bist.}
\stoptext

Uschi
___
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] streams reversed?

2023-09-13 Thread jbf
I am making some progress with a bilingual text using the streams 
mechanism suggested by Wolfgang: https://wiki.contextgarden.net/Columns, 
but see below.


The aim has been to have en and vi on facing pages (en left, vi right).

It works correctly for the Foreword in two languages (en, vi) in 
frontmatter.


When I come to bodymatter and Chapter 1, again it works, except that the 
positions of the languages are reversed, so I end up with vi on the left 
and en on the right. By Chapter 2 we are back to the correct position 
once more (en left and vi right).


I want to know why this is happening, and if I can prevent it happening.

I am using the code you can see below, except that instead of 
\startoutputstream[one] and \startoutputstream[two] etc.  I am using 
[en-front][vi-front], and then in bodymatter [en-chap1][vi-chap1] etc. 
etc. with the relevant repetitions of these identifiers where needed. I 
assume that to get a degree of synchronization I need to use this 
approach for each set of chapters. But I cannot understand why the 
languages alternate their starting page positions each chapter.


There are other issues I have to solve, but first of all I wish to 
resolve this one.


Julian


The original (Wolfgang) code is as follows:

\starttext

\startoutputstream[one]
   \startcolor[red]
   \dorecurse{10}{\input  knuth\par}
   \stopcolor
\stopoutputstream

\startoutputstream[two]
   \startcolor[green]
   \dorecurse{10}{\input  zapf\par}
   \stopcolor
\stopoutputstream

\synchronizestreams[one,two]

\setbox\scratchboxone\outputstreambox[one]
\setbox\scratchboxtwo\outputstreambox[two]

\doloop
 {\ifvoid\scratchboxone
\exitloop
  \else
\setbox\scratchboxfour\vsplit\scratchboxone  to\textheight
\vbox  to\vsize{\box\scratchboxfour\vss}%
\setbox\scratchboxfive\vsplit\scratchboxtwo  to\textheight
\vbox  to\vsize{\box\scratchboxfive\vss}%
  \fi}

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