ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Label in externalfigures
@ 2020-02-12 15:49 Jan-Erik Hägglöf
  2020-02-12 16:16 ` Wolfgang Schuster
  0 siblings, 1 reply; 6+ messages in thread
From: Jan-Erik Hägglöf @ 2020-02-12 15:49 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Dear Members!

I have a question on how to achieve something like this.

\IncludePicture[picture.pdf][xpos=2, ypos= 4, label=some text]

I know there is a similar function in the simple slides module but I need it in my documents, often exams to my students, so caption is mainly not necessary.

The background to this is that I often creating pictures in Inkscape and export it to pdf but sometimes I do screenshots and save it in .png or .pdf format. So I just want to put labels in it like a layer in same size as the included picture.

Or is this something that’s already solved so "reinventing wheel" is unnecessary?

Thanks in advance

Jan-Erik
___________________________________________________________________________________
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] 6+ messages in thread

* Re: Label in externalfigures
  2020-02-12 15:49 Label in externalfigures Jan-Erik Hägglöf
@ 2020-02-12 16:16 ` Wolfgang Schuster
  2020-02-12 17:01   ` Jan-Erik Hägglöf
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2020-02-12 16:16 UTC (permalink / raw)
  To: ntg-context

On Wed, 12 Feb 2020 16:49:02 +0100
Jan-Erik Hägglöf <janerik.hagglof@bahnhof.se> wrote:

> Dear Members!
> 
> I have a question on how to achieve something like this.
> 
> \IncludePicture[picture.pdf][xpos=2, ypos= 4, label=some text]

What is the expected output of this command?

> I know there is a similar function in the simple slides module but I need it in my documents, often exams to my students, so caption is mainly not necessary.
> 
> The background to this is that I often creating pictures in Inkscape and export it to pdf but sometimes I do screenshots and save it in .png or .pdf format. So I just want to put labels in it like a layer in same size as the included picture.
> 
> Or is this something that’s already solved so "reinventing wheel" is unnecessary?

Look at the example for \layeredtext, \collectedtext or \setcollector in the details [1] manual.

[1] http://www.pragma-ade.nl/general/manuals/details.pdf

Wolfgang
___________________________________________________________________________________
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] 6+ messages in thread

* Re: Label in externalfigures
  2020-02-12 16:16 ` Wolfgang Schuster
@ 2020-02-12 17:01   ` Jan-Erik Hägglöf
  2020-02-12 19:10     ` Hans Hagen
  0 siblings, 1 reply; 6+ messages in thread
From: Jan-Erik Hägglöf @ 2020-02-12 17:01 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

The expected output should be like this, see example in the link below

https://drive.google.com/file/d/13pCuUvNeL7T_Hs7-qrKZclkadcJ7_jVV/view?usp=sharing <https://drive.google.com/file/d/13pCuUvNeL7T_Hs7-qrKZclkadcJ7_jVV/view?usp=sharing>

So that I have a picture so I can change the label text inside according to different needs e.g change from 37° to 41° without reediting it in Inkscape.

A similar properties like latex export picture.pdf_tex which is a function in Inkscape

I investigate the details manual tip you provided, thanks a lot.


> 12 feb. 2020 kl. 17:16 skrev Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>:
> 
> On Wed, 12 Feb 2020 16:49:02 +0100
> Jan-Erik Hägglöf <janerik.hagglof@bahnhof.se> wrote:
> 
>> Dear Members!
>> 
>> I have a question on how to achieve something like this.
>> 
>> \IncludePicture[picture.pdf][xpos=2, ypos= 4, label=some text]
> 
> What is the expected output of this command?
> 
>> I know there is a similar function in the simple slides module but I need it in my documents, often exams to my students, so caption is mainly not necessary.
>> 
>> The background to this is that I often creating pictures in Inkscape and export it to pdf but sometimes I do screenshots and save it in .png or .pdf format. So I just want to put labels in it like a layer in same size as the included picture.
>> 
>> Or is this something that’s already solved so "reinventing wheel" is unnecessary?
> 
> Look at the example for \layeredtext, \collectedtext or \setcollector in the details [1] manual.
> 
> [1] http://www.pragma-ade.nl/general/manuals/details.pdf
> 
> Wolfgang
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________


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

[-- Attachment #2: Type: text/plain, Size: 493 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] 6+ messages in thread

* Re: Label in externalfigures
  2020-02-12 17:01   ` Jan-Erik Hägglöf
@ 2020-02-12 19:10     ` Hans Hagen
  2020-02-13  9:35       ` Jan-Erik Hägglöf
  0 siblings, 1 reply; 6+ messages in thread
From: Hans Hagen @ 2020-02-12 19:10 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Jan-Erik Hägglöf

On 2/12/2020 6:01 PM, Jan-Erik Hägglöf wrote:
> The expected output should be like this, see example in the link below
> 
> https://drive.google.com/file/d/13pCuUvNeL7T_Hs7-qrKZclkadcJ7_jVV/view?usp=sharing
> 
> So that I have a picture so I can change the label text inside according 
> to different needs e.g change from 37° to 41° without reediting it in 
> Inkscape.
> 
> A similar properties like latex export picture.pdf_tex which is a 
> function in Inkscape
> 
> I investigate the details manual tip you provided, thanks a lot.
you might want to peek into the luametafun manual as svg is discussed 
there, including label stuff

what you can also try (with lmtx) is this (no real interface yet):

\starttext

\hbox\bgroup
   \ctxlua{metapost.startsvghashing()}%
   \includesvgfile[labels-004.svg]%
   \ctxlua{metapost.stopsvghashing()}%
\egroup

\stoptext

which should turn your labels into tex, so you can typeset them as tex 
(so $\\sin(x)$ comes out as math) it's no big deal to add a remap option 
there but then i'd rather go for symbolic names

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 / 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] 6+ messages in thread

* Re: Label in externalfigures
  2020-02-12 19:10     ` Hans Hagen
@ 2020-02-13  9:35       ` Jan-Erik Hägglöf
  2020-02-14 22:22         ` Jan-Erik Hägglöf
  0 siblings, 1 reply; 6+ messages in thread
From: Jan-Erik Hägglöf @ 2020-02-13  9:35 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

I’ve tested this but it appears outside, not as an layer over the picture.

\startMPcode 
draw lmt_svg [
	filename = "steguppgift.svg",
	height = 5cm,
	width = 10cm,
	] ;
label(\sometxt{5,0m},(63.936298,129.563995));
label(\sometxt{37°},(95.652702,27.367201));	
\stopMPcode

Thanks 

/Janne
> 12 feb. 2020 kl. 20:10 skrev Hans Hagen <j.hagen@xs4all.nl>:
> 
> On 2/12/2020 6:01 PM, Jan-Erik Hägglöf wrote:
>> The expected output should be like this, see example in the link below
>> https://drive.google.com/file/d/13pCuUvNeL7T_Hs7-qrKZclkadcJ7_jVV/view?usp=sharing
>> So that I have a picture so I can change the label text inside according to different needs e.g change from 37° to 41° without reediting it in Inkscape.
>> A similar properties like latex export picture.pdf_tex which is a function in Inkscape
>> I investigate the details manual tip you provided, thanks a lot.
> you might want to peek into the luametafun manual as svg is discussed there, including label stuff
> 
> what you can also try (with lmtx) is this (no real interface yet):
> 
> \starttext
> 
> \hbox\bgroup
>  \ctxlua{metapost.startsvghashing()}%
>  \includesvgfile[labels-004.svg]%
>  \ctxlua{metapost.stopsvghashing()}%
> \egroup
> 
> \stoptext
> 
> which should turn your labels into tex, so you can typeset them as tex (so $\\sin(x)$ comes out as math) it's no big deal to add a remap option there but then i'd rather go for symbolic names
> 
> 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
> -----------------------------------------------------------------


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

[-- Attachment #2: Type: text/plain, Size: 493 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] 6+ messages in thread

* Re: Label in externalfigures
  2020-02-13  9:35       ` Jan-Erik Hägglöf
@ 2020-02-14 22:22         ` Jan-Erik Hägglöf
  0 siblings, 0 replies; 6+ messages in thread
From: Jan-Erik Hägglöf @ 2020-02-14 22:22 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Now finally after consulting the luametafun and the MetaFun manual I’ve found what I was looking for:

The code:

\startMPcode 
picture p; p := lmt_svg [ filename = "steguppgift.svg", width = 400 ] ;
draw p;
path linje ; linje := (15,-330) -- (280,-90); % adding a missing line in the .svg file
drawarrow linje withcolor black ;
draw thelabel("37°",(160,-330));
draw thelabel("$5,0$m",(150,-160));
\stopMPcode





This was a fun learning experience so thanks again

> 13 feb. 2020 kl. 10:35 skrev Jan-Erik Hägglöf <janerik.hagglof@bahnhof.se>:
> 
> I’ve tested this but it appears outside, not as an layer over the picture.
> 
> \startMPcode 
> draw lmt_svg [
> 	filename = "steguppgift.svg",
> 	height = 5cm,
> 	width = 10cm,
> 	] ;
> label(\sometxt{5,0m},(63.936298,129.563995));
> label(\sometxt{37°},(95.652702,27.367201));	
> \stopMPcode
> 
> Thanks 
> 
> /Janne
>> 12 feb. 2020 kl. 20:10 skrev Hans Hagen <j.hagen@xs4all.nl <mailto:j.hagen@xs4all.nl>>:
>> 
>> On 2/12/2020 6:01 PM, Jan-Erik Hägglöf wrote:
>>> The expected output should be like this, see example in the link below
>>> https://drive.google.com/file/d/13pCuUvNeL7T_Hs7-qrKZclkadcJ7_jVV/view?usp=sharing <https://drive.google.com/file/d/13pCuUvNeL7T_Hs7-qrKZclkadcJ7_jVV/view?usp=sharing>
>>> So that I have a picture so I can change the label text inside according to different needs e.g change from 37° to 41° without reediting it in Inkscape.
>>> A similar properties like latex export picture.pdf_tex which is a function in Inkscape
>>> I investigate the details manual tip you provided, thanks a lot.
>> you might want to peek into the luametafun manual as svg is discussed there, including label stuff
>> 
>> what you can also try (with lmtx) is this (no real interface yet):
>> 
>> \starttext
>> 
>> \hbox\bgroup
>>  \ctxlua{metapost.startsvghashing()}%
>>  \includesvgfile[labels-004.svg]%
>>  \ctxlua{metapost.stopsvghashing()}%
>> \egroup
>> 
>> \stoptext
>> 
>> which should turn your labels into tex, so you can typeset them as tex (so $\\sin(x)$ comes out as math) it's no big deal to add a remap option there but then i'd rather go for symbolic names
>> 
>> Hans
>> 
>> -----------------------------------------------------------------
>>                                          Hans Hagen | PRAGMA ADE
>>              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>>       tel: 038 477 53 69 | www.pragma-ade.nl <http://www.pragma-ade.nl/> | www.pragma-pod.nl <http://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 / 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
> ___________________________________________________________________________________


[-- Attachment #1.2.1: Type: text/html, Size: 2230 bytes --]

[-- Attachment #1.2.2: steguppgift.svg --]
[-- Type: image/svg+xml, Size: 28056 bytes --]

[-- Attachment #1.2.3: Type: text/html, Size: 6520 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 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] 6+ messages in thread

end of thread, other threads:[~2020-02-14 22:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-12 15:49 Label in externalfigures Jan-Erik Hägglöf
2020-02-12 16:16 ` Wolfgang Schuster
2020-02-12 17:01   ` Jan-Erik Hägglöf
2020-02-12 19:10     ` Hans Hagen
2020-02-13  9:35       ` Jan-Erik Hägglöf
2020-02-14 22:22         ` Jan-Erik Hägglöf

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