Re: [NTG-context] Foonotes in Captions ... again

2022-06-15 Thread Max Chernoff via ntg-context

What's the current state of affairs regarding footnotes in floats? Both version 
in the example below don't quite work...
(Ideally, the note should be on the page with the float and the caption, but 
the numbering should also be adjusted.)


We can completely abuse a bunch of different ConTeXt features to ensure
that the footnote numbers are always in the page order.

% New Code
\unprotect

\startluacode
userdata.visual_order = 0
userdata.input_order = 0
userdata.save_data = job.passes.define("saved_footnotes")
userdata.previous_data = job.passes.getcollected("saved_footnotes")

interfaces.implement {
name = "set_footnote_number",
actions = function ()
userdata.input_order = userdata.input_order + 1

local input_index = userdata.input_order
local page_index = userdata.previous_data[input_index]

if page_index then
structures.counters.set("footnote", 1, page_index - 1)
end
end
}
\stopluacode

\def\save_footnote_data#1{%
\latelua{
userdata.visual_order = userdata.visual_order + 1
userdata.save_data[#1] = userdata.visual_order
}%
}

\let\old_footnote=\footnote

\starttexdefinition protected footnote #1
\begingroup
\clf_set_footnote_number

\def\insert##1\bgroup##2\egroup{
\normalexpanded{
\noexpand\save_footnote_data
{\cldcontext{userdata.input_order}}
}
\normalinsert##1{##2}
}

\old_footnote{#1}
\endgroup
\stoptexdefinition

\protect

% Original Example

\starttext

\footnote{asdf} \footnote{asdf} \footnote{asdf}

\input ward

\startplacefigure[title={asdfasdf\footnote{test 1}}]
\externalfigure[cow.pdf]
\stopplacefigure

\footnote{asdf} \footnote{asdf} \footnote{asdf}

\startplacefigure[title={asdfasdf\footnote{test 2}}]
\externalfigure[cow.pdf][height=10cm]
\stopplacefigure

\footnote{asdf} \footnote{asdf} \footnote{asdf}


\page
\footnote{asdf} \footnote{asdf} \footnote{asdf}

\input ward

\startplacefigure[title={asdfasdf\footnote{test 1}}]
\externalfigure[cow.pdf]
\stopplacefigure

\footnote{asdf} \footnote{asdf} \footnote{asdf}

% (Can't use postponingnotes)
% \startpostponingnotes
\startplacefigure[title={asdfasdf\footnote{test 2}}]
\externalfigure[cow.pdf][height=10cm]
\stopplacefigure
% \stoppostponingnotes

\footnote{asdf} \footnote{asdf} \footnote{asdf}
\stoptext

Here, we save a mapping between each footnote's index in the input and
its index in the output to the .tuc file. The code is definitely not
pretty, but works well enough for the sample file provided.

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] lmtx installation paths not working

2022-06-15 Thread Bruce Horrocks via ntg-context


> On 14 Jun 2022, at 12:20, Jano Kula via ntg-context  
> wrote:
> 
> Do you have an idea how to fix problem?
> I will be thankful for an advice, it is quite urgent (everything was working 
> yesterday).

Do you have an anti-virus product installed?

In the past I've noticed that Symantec sometimes gives a false positive on some 
of the ConTeXt files as they are installed and silently deletes them thinking 
they contain malware.

The result is a broken ConTeXt because files are missing but you have no idea 
which files are missing. :-(

Try temporarily disabling AV and then do a complete re-install into an empty 
C:/data/context directory.

—
Bruce Horrocks
Hampshire, UK

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Why are some images rendered very tiny?

2022-06-15 Thread Henning Hraban Ramm via ntg-context

Am 15.06.22 um 18:11 schrieb Joel via ntg-context:
I wrote this macro to display images in my book. It should place the 
image to the left, filling ~50% of \textwidth, then the caption is to 
the right.


\setupcaption[location=right, minwidth=.5\textwidth]
\define[4]\figureis{%
     \placefigure{#2, Courtesy #3, photo no. 
#1\nocite[#4]{}}{\externalfigure[#1][maxheight=.7\paperheight, 
maxwidth=.5\paperwidth, minwidth=.5\paperwidth]}

}

#1 = filename, other variables are used for reference/credit details.

The problem is, somehow some images are inexplicably displayed very tiny 
on the page. I check the image file and they are not small, but somehow 
is rendered small with the code above.


What is wrong in my code?


There are no parameters "minwidth" or "minheight", see 
https://wiki.contextgarden.net/Command/setupexternalfigure


It’s probable that your pictures have a high resolution (dpi) defined, 
so ConTeXt displays them according to that in their “natural” size.


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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] Why are some images rendered very tiny?

2022-06-15 Thread Joel via ntg-context
I wrote this macro to display images in my book. It should place the image to 
the left, filling ~50% of \textwidth, then the caption is to the right.

\setupcaption[location=right, minwidth=.5\textwidth]
\define[4]\figureis{%
    \placefigure{#2, Courtesy #3, photo no. 
#1\nocite[#4]{}}{\externalfigure[#1][maxheight=.7\paperheight, 
maxwidth=.5\paperwidth, minwidth=.5\paperwidth]}
}
#1 = filename, other variables are used for reference/credit details.

The problem is, somehow some images are inexplicably displayed very tiny on the 
page. I check the image file and they are not small, but somehow is rendered 
small with the code above.

What is wrong in my code?
--Joel
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


[NTG-context] Foonotes in Captions ... again

2022-06-15 Thread Denis Maier via ntg-context
Hi everyone

What's the current state of affairs regarding footnotes in floats? Both version 
in the example below don't quite work...
(Ideally, the note should be on the page with the float and the caption, but 
the numbering should also be adjusted.)

Best,
Denis

\starttext

\footnote{asdf} \footnote{asdf} \footnote{asdf}

\input ward

\startplacefigure[title={asdfasdf\footnote{test 1}}]
\externalfigure[cow.pdf]
\stopplacefigure

\footnote{asdf} \footnote{asdf} \footnote{asdf}

\startplacefigure[title={asdfasdf\footnote{test 2}}]
\externalfigure[cow.pdf][height=10cm]
\stopplacefigure

\footnote{asdf} \footnote{asdf} \footnote{asdf}


\page
\footnote{asdf} \footnote{asdf} \footnote{asdf}

\input ward

\startplacefigure[title={asdfasdf\footnote{test 1}}]
\externalfigure[cow.pdf]
\stopplacefigure

\footnote{asdf} \footnote{asdf} \footnote{asdf}

\startpostponingnotes
\startplacefigure[title={asdfasdf\footnote{test 2}}]
\externalfigure[cow.pdf][height=10cm]
\stopplacefigure
\stoppostponingnotes

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

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___


Re: [NTG-context] Rotating jpeg image gives weird output

2022-06-15 Thread Denis Maier via ntg-context
Thanks for all your help. Using Magick had no effect so I've had another look 
at my setup. It turned out I had this in m

\setupexternalfigures
  [maxwidth=\textwidth,
  maxheight=0.8\textheight.
  location={local,global},
]

The period to end maxheight is obviously a mistake. (However, I'm still 
perplexed that this only shows up when the image is rotated...)

Sorry for the noise.

Denis

> -Ursprüngliche Nachricht-
> Von: Max Chernoff 
> Gesendet: Mittwoch, 15. Juni 2022 00:52
> An: Maier, Denis Christian (UB) ; ntg-context@ntg.nl
> Betreff: Re: [NTG-context] Rotating jpeg image gives weird output
> 
> > Any other ideas? (I tend to think the image is corrupted in one way or
> > the other, but I have no clue how to fix that.)
> 
> You could try making a new image with the same content. Assuming you're
> on Windows 10/11, install Image Magick
> 
>  winget install -e --id ImageMagick.ImageMagick
> 
> then run
> 
>  magick convert -strip image.jpg temp.tga
>  magick convert -strip temp.tga new-image.jpg
>  del temp.tga
> 
> which should give you a new image "new-image.jpg" that shouldn't be
> corrupt. If you are still having problems with this new image, then the issue 
> is
> likely with ConTeXt itself, and this specific image is just triggering it
> somehow.
> 
> -- Max
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___