[dev-context] 2 patches for grph-inc

Aditya Mahajan adityam at umich.edu
Fri Sep 7 00:43:03 CEST 2012


On Fri, 7 Sep 2012, Peter Münster wrote:

> 2.) To avoid crap in the width and height options:
>
> --8<---------------cut here---------------start------------->8---
> --- grph-inc.mkiv~	2012-07-20 23:26:52.000000000 +0200
> +++ grph-inc.mkiv	2012-08-01 00:02:23.851094854 +0200
> @@ -293,6 +293,10 @@
>    %
>    \the\t_grph_include_local_settings
>    \dostarttagged\t!image\empty
> +   \edef\current_width{\externalfigureparameter\c!width}%
> +   \edef\current_height{\externalfigureparameter\c!height}%
> +   \def\nocrap##1{\doifnotemptyvalue{##1}{%
> +       \the\dimexpr\csname##1\endcsname\relax}}%

It is better to use a more meaningful name. This can be a general macro 
that will be useful outside of the figure inclusion code as well.

>    \ctxlua{figures.push {
>         name       = "\p_grph_include_name",
>         label      = "\p_grph_include_label",
> @@ -312,8 +316,8 @@
>         resolution = "\externalfigureparameter\c!resolution",
>         color      = "\internalspotcolorparent{\externalfigureparameter\c!color}", % hack is needed
>         ["repeat"] = "\externalfigureparameter\c!repeat",
> -        width      = "\externalfigureparameter\c!width",  % can be crap
> -        height     = "\externalfigureparameter\c!height", % can be crap
> +        width      = "\nocrap{current_width}",  % no more crap
> +        height     = "\nocrap{current_height}", % no more crap
>     } }%

Aditya


More information about the dev-context mailing list