Closed vittorioromeo closed 8 years ago
Currently, macro parameters must have the same delimiters, we can not mix (...)
and {...}
.
This constraint was added to help writing macros followed by expressions that could look like arguments (e.g. \macro(arg1)...(argn) [image.png](...)
==> [image.png]
is not considered as a argument of macro
)
With this syntax, the caption and this new argument would be optional which may be ambiguous in some cases (when only one is given).
Do you think:
\twopi(path/image.png)(Caption){#some_id width=20%}
could be replaced with:
\twopi(path/image.png{#some_id width=20%})(Caption)
Attributes related to the image would be grouped together in the first argument.
Another quick and dirty workaround would be to write:
\dot(image)(caption)
~~~~~~~~~
....
~~~~~~~~~{#some_id width=20%}
But I admit it looks bad ;-)
You can also use spaces and new lines (no blank line) to visually separate arguments:
\twopi(path/image.png{#some_id width=20%})
(Caption)
~~~~~~~~~~~~~~~~~
....
~~~~~~~~~~~~~~~~~
I think the
\twopi(path/image.png{#some_id width=20%})
(Caption)
syntax looks fine.
Image attributes can now be added with this syntax (spaces around brackets are accepted) :
\twopi(path/image { #some_id width=20% } )
(Caption)
~~~~~~~~~~~~~~~~~
....
~~~~~~~~~~~~~~~~~
Thank you for the quick feature implementation. Works perfectly in my use case!
Problem
I have come across a situation where I'd like to resize the figures generated by pp.
As far I can see, pp generates Pandoc image syntax after generating the figures.
I think Pandoc image syntax is limited, as it's impossible to choose figure alignment and scale.
Proposed solution
Pandoc supports
width
andheight
attributes for images. Look for thelink_attributes
extension in the docs here.For example, the following Pandoc code:
Generates the following LaTeX code:
You can try this online, and play around with other outputs.
I propose extending pp's syntax as such:
The above example will generate the following Pandoc syntax:
In short, what I propose is:
{ ... }
field to graph generating functions such as\dot
and\twopi
, called attribute field.(...)
caption field.