ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* defining a command
@ 2007-12-17 14:44 Roger Mason
  2007-12-17 16:02 ` Wolfgang Schuster
  0 siblings, 1 reply; 5+ messages in thread
From: Roger Mason @ 2007-12-17 14:44 UTC (permalink / raw)
  To: ntg-context

Hello,

I have this definition:

\def\oneplot#1#2#3%
{\placefigure
  [here][#3]
  {\bfc #2}
  {\hfil \scale[width=10.5cm]{#1} \hfil}
}

(It is modified from an example on the wiki that takes only the first
two arguments).

I use it like this:

\oneplot
% image
% caption
% reference
{\externalfigure[Fluorita_green]}
{Fluorite cleavage}
{cleavage}

but the reference is ignored and I get ?? in the compiled document.

Could someone point out my error please?

Cheers,
Roger
___________________________________________________________________________________
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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: defining a command
  2007-12-17 14:44 defining a command Roger Mason
@ 2007-12-17 16:02 ` Wolfgang Schuster
  2007-12-18 12:54   ` Roger Mason
  2007-12-18 13:54   ` Roger Mason
  0 siblings, 2 replies; 5+ messages in thread
From: Wolfgang Schuster @ 2007-12-17 16:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users

2007/12/17, Roger Mason <rmason@esd.mun.ca>:
> Hello,
>
> I have this definition:
>
> \def\oneplot#1#2#3%
> {\placefigure
>   [here][#3]
>   {\bfc #2}
>   {\hfil \scale[width=10.5cm]{#1} \hfil}
> }
>
> (It is modified from an example on the wiki that takes only the first
> two arguments).
>
> I use it like this:
>
> \oneplot
> % image
> % caption
> % reference
> {\externalfigure[Fluorita_green]}
> {Fluorite cleavage}
> {cleavage}
>
> but the reference is ignored and I get ?? in the compiled document.
>
> Could someone point out my error please?
>
> Cheers,
> Roger

\define[3]\oneplot
  {\placefigure[here][#3]{\bfc#2}{\scale[width=10.5cm]{#1}}}

\starttext
\oneplot{\blackrule[width=1cm,height=1cm]}{Blackrule}{plot:blackrule}
See at \in{Plot}[plot:blackrule].
\stoptext

Alternative solution with a real ConTeXt definition:

\definefloat[plot][plots][figure]
\setupfloat[plot][command={\scale[width=5cm]}]
\starttext
\placefigure{Blackrule}{\blackrule[width=1cm,height=1cm]}
\placeplot{Blackrule}{{\blackrule[width=1cm,height=1cm]}}
\stoptext

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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: defining a command
  2007-12-17 16:02 ` Wolfgang Schuster
@ 2007-12-18 12:54   ` Roger Mason
  2007-12-18 13:54   ` Roger Mason
  1 sibling, 0 replies; 5+ messages in thread
From: Roger Mason @ 2007-12-18 12:54 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello Wolfgang,

"Wolfgang Schuster" <schuster.wolfgang@googlemail.com> writes:

> \define[3]\oneplot
>   {\placefigure[here][#3]{\bfc#2}{\scale[width=10.5cm]{#1}}}
>
> \starttext
> \oneplot{\blackrule[width=1cm,height=1cm]}{Blackrule}{plot:blackrule}
> See at \in{Plot}[plot:blackrule].
> \stoptext
>
> Alternative solution with a real ConTeXt definition:
>
> \definefloat[plot][plots][figure]
> \setupfloat[plot][command={\scale[width=5cm]}]
> \starttext
> \placefigure{Blackrule}{\blackrule[width=1cm,height=1cm]}
> \placeplot{Blackrule}{{\blackrule[width=1cm,height=1cm]}}
> \stoptext

Both methods work fine.  Given that I'm using Context then I will use
the Contextish way of doing things.

Many thanks for you help,

Roger
___________________________________________________________________________________
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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: defining a command
  2007-12-17 16:02 ` Wolfgang Schuster
  2007-12-18 12:54   ` Roger Mason
@ 2007-12-18 13:54   ` Roger Mason
  2007-12-18 14:11     ` Wolfgang Schuster
  1 sibling, 1 reply; 5+ messages in thread
From: Roger Mason @ 2007-12-18 13:54 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hello again,

"Wolfgang Schuster" <schuster.wolfgang@googlemail.com> writes:

> \definefloat[plot][plots][figure]
> \setupfloat[plot][command={\scale[width=5cm]}]

What would the plural form be used for?  Could I use it to define a
combination?  If so, how?

Thanks for the help,

Roger
___________________________________________________________________________________
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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: defining a command
  2007-12-18 13:54   ` Roger Mason
@ 2007-12-18 14:11     ` Wolfgang Schuster
  0 siblings, 0 replies; 5+ messages in thread
From: Wolfgang Schuster @ 2007-12-18 14:11 UTC (permalink / raw)
  To: mailing list for ConTeXt users

2007/12/18, Roger Mason <rmason@esd.mun.ca>:
> Hello again,
>
> "Wolfgang Schuster" <schuster.wolfgang@googlemail.com> writes:
>
> > \definefloat[plot][plots][figure]
> > \setupfloat[plot][command={\scale[width=5cm]}]
>
> What would the plural form be used for?  Could I use it to define a
> combination?  If so, how?
>
> Thanks for the help,
>
> Roger

You need normaly only two parameters for \definefloat, e.g. the example
\definefloat[plot][plot]

create the command \placeplot to place the plots in your document
and the commands \placelistofplots and \completelistofplots to place
a content list with a plots in your document.

The \definefloat command with three arguments did the same thing,
but the caption of the plots is taken from \placefigure and the plotnumber
is also incremented with every figure in your document.

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://tex.aanhet.net
archive  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2007-12-18 14:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-17 14:44 defining a command Roger Mason
2007-12-17 16:02 ` Wolfgang Schuster
2007-12-18 12:54   ` Roger Mason
2007-12-18 13:54   ` Roger Mason
2007-12-18 14:11     ` Wolfgang Schuster

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