ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Placing a figure with a command for the file in mkiv
@ 2018-01-27 10:28 Otared Kavian
  2018-01-27 10:43 ` Wolfgang Schuster
  0 siblings, 1 reply; 5+ messages in thread
From: Otared Kavian @ 2018-01-27 10:28 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi all,

I have a document (sort of proceedings of a meeting) which have to contain several pages, with each page dedicated to an author and a specific figure (say a photo). In mkii I used to do have a command like
	\define\authorpicture{hacker.jpg}
and then use a command like:
	\externalfigure[\authorpicture]
to include that figure in the text, and everythinng worked ver nicely in my big document.

Unfortunately this scheme does not work anymore in mkiv… 
How can I change the following code (which works in mkii) in order to have it work in mkiv?

Thanks in advance for any help: OK

%%% begin dynamic-filename-figure.tex
\starttext
\define\authorpicture{hacker.jpg}

\placefigure[here][fig:Myfigure]{}
	{\externalfigure[\authorpicture]}
	
\stoptext
%%% end dynamic-filename-figure.tex
___________________________________________________________________________________
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
___________________________________________________________________________________

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

* Re: Placing a figure with a command for the file in mkiv
  2018-01-27 10:28 Placing a figure with a command for the file in mkiv Otared Kavian
@ 2018-01-27 10:43 ` Wolfgang Schuster
  2018-01-27 11:31   ` Otared Kavian
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Schuster @ 2018-01-27 10:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 820 bytes --]


> Otared Kavian <mailto:otared@gmail.com>
> 27. Januar 2018 um 11:28
> Hi all,
>
> I have a document (sort of proceedings of a meeting) which have to 
> contain several pages, with each page dedicated to an author and a 
> specific figure (say a photo). In mkii I used to do have a command like
> \define\authorpicture{hacker.jpg}
> and then use a command like:
> \externalfigure[\authorpicture]
> to include that figure in the text, and everythinng worked ver nicely 
> in my big document.
>
> Unfortunately this scheme does not work anymore in mkiv…
> How can I change the following code (which works in mkii) in order to 
> have it work in mkiv?
>
> Thanks in advance for any help: OK
>
> %%% begin dynamic-filename-figure.tex
> \starttext
> \define\authorpicture{hacker.jpg}

\defineexpandable\...{...}

Wolfgang

[-- Attachment #1.2: Type: text/html, Size: 1839 bytes --]

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

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

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

* Re: Placing a figure with a command for the file in mkiv
  2018-01-27 10:43 ` Wolfgang Schuster
@ 2018-01-27 11:31   ` Otared Kavian
  2018-01-27 11:39     ` Wolfgang Schuster
  0 siblings, 1 reply; 5+ messages in thread
From: Otared Kavian @ 2018-01-27 11:31 UTC (permalink / raw)
  To: mailing list for ConTeXt users



> On 27 Jan 2018, at 11:43, Wolfgang Schuster <schuster.wolfgang@gmail.com> wrote:
> […]
> \defineexpandable\...{…}

Hi Wolfgang,

Thanks again! Indeed 

	\defineexpandable\authorpicture{hacker.jpg}

solves the problem in the simplified case I was reporting. 
However in the real case, the file « hacker.jpg » is in fact a file which depends on other variables, and when I include \defineexpandable in the \getvariable environment then it does not work anymore: saying

	\defineexpandable\authorpicture{\getvariable{talk}{picture}}
or
	\defineexpandable\authorpicture{\expanded{\getvariable{talk}{picture}}}
or
	\defineexpandable\authorpicture{\expandafter\getvariable{talk}{picture}}
does not solve the problem.

Below is a minimal example showing the issue (with what you taught me last week…).

Best regards: OK

\starttext
\startbuffer[pagetalk]
	\starttabulate[|f{\bi}l|p|][before=]%
	\NC Speaker \EQ \getvariable{talk}{speakerfirstname} {\sc \getvariable{talk}{speakername}}
	 \NC\NR
	\NC Title   \EQ \getvariable{talk}{title}    \NC\NR
	\stoptabulate
	\defineexpandable\authorpicture{\getvariable{talk}{picture}}
	\placefigure[here][]{}
		{\externalfigure[\authorpicture]}
\page
\stopbuffer

\setvariable{talk}{set}{\getbuffer[pagetalk]}

\setvariables[talk]%
	[speakername={Hacker},
	title={Up to date hacking},
	picture=hacker.jpg
	]
	
\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
___________________________________________________________________________________

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

* Re: Placing a figure with a command for the file in mkiv
  2018-01-27 11:31   ` Otared Kavian
@ 2018-01-27 11:39     ` Wolfgang Schuster
  2018-01-27 13:36       ` Otared Kavian
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Schuster @ 2018-01-27 11:39 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 1673 bytes --]

> Otared Kavian <mailto:otared@gmail.com>
> 27. Januar 2018 um 12:31
>
>
> Hi Wolfgang,
>
> Thanks again! Indeed
>
> \defineexpandable\authorpicture{hacker.jpg}
>
> solves the problem in the simplified case I was reporting.
> However in the real case, the file « hacker.jpg » is in fact a file 
> which depends on other variables, and when I include \defineexpandable 
> in the \getvariable environment then it does not work anymore: saying
>
> \defineexpandable\authorpicture{\getvariable{talk}{picture}}
> or
> \defineexpandable\authorpicture{\expanded{\getvariable{talk}{picture}}}
> or
> \defineexpandable\authorpicture{\expandafter\getvariable{talk}{picture}}
> does not solve the problem.
>
> Below is a minimal example showing the issue (with what you taught me 
> last week…).
>
> Best regards: OK
>
> \starttext
> \startbuffer[pagetalk]
> \starttabulate[|f{\bi}l|p|][before=]%
> \NC Speaker \EQ \getvariable{talk}{speakerfirstname} {\sc 
> \getvariable{talk}{speakername}}
> \NC\NR
> \NC Title \EQ \getvariable{talk}{title} \NC\NR
> \stoptabulate
> \defineexpandable\authorpicture{\getvariable{talk}{picture}}
> \placefigure[here][]{}
> {\externalfigure[\authorpicture]}

You can put the \getvariable command in \externalfigure.

\startplacefigure[location=here]
   \externalfigure[\getvariable{talk}{picture}]
\stopplacefigure

> \page
> \stopbuffer
>
> \setvariable{talk}{set}{\getbuffer[pagetalk]}
>
> \setvariables[talk]%
> [speakername={Hacker},
> title={Up to date hacking},
> picture=hacker.jpg
> ]
You’re missing a coma after “picture=hacker.jpg” which results in “jpeg ”
(which a space at the end) as file extension for the image.

Wolfgang

[-- Attachment #1.2: Type: text/html, Size: 3077 bytes --]

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

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

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

* Re: Placing a figure with a command for the file in mkiv
  2018-01-27 11:39     ` Wolfgang Schuster
@ 2018-01-27 13:36       ` Otared Kavian
  0 siblings, 0 replies; 5+ messages in thread
From: Otared Kavian @ 2018-01-27 13:36 UTC (permalink / raw)
  To: mailing list for ConTeXt users



> On 27 Jan 2018, at 12:39, Wolfgang Schuster <schuster.wolfgang@gmail.com> wrote:
>> […]
> […]
> You’re missing a coma after “picture=hacker.jpg” which results in “jpeg ”
> (which a space at the end) as file extension for the image.

Yes indeed this was the issue… In fact I had tested « picture={hacker.jpg} » without the comma and that one also did not work, while with a comma as in « picture={hacker.jpg}, » the filename is well understood.

Many thanks and best regards: OK

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

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

end of thread, other threads:[~2018-01-27 13:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-27 10:28 Placing a figure with a command for the file in mkiv Otared Kavian
2018-01-27 10:43 ` Wolfgang Schuster
2018-01-27 11:31   ` Otared Kavian
2018-01-27 11:39     ` Wolfgang Schuster
2018-01-27 13:36       ` Otared Kavian

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