* Export attributes for babel blocks
@ 2017-10-02 6:46 Juan Amiguet
2017-10-02 7:05 ` Thomas S. Dye
2017-10-02 10:26 ` Eric S Fraga
0 siblings, 2 replies; 5+ messages in thread
From: Juan Amiguet @ 2017-10-02 6:46 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 990 bytes --]
Dear all,
I have been having this issue for quite a while perhaps I am using the
feature wrong and someone can enlighten me or perhaps someone can point me
at the bit of code I can patch it myself.
Here is the issue:
I have a babel block such as
#+begin_src dot :file test.png
digraph test {
A -> B
}
#+end_src
This will create after execution a
#+RESULT:
[[file:./test.png]]
Now if I would like have something like :width .5/.linewith as a attribute
to the image the only I have found is to do the following
#+begin_src dot :file test.png :exports none
digraph test {
A -> B
}
#+end_src
#+attr_latex: width=.5/linewidth
[[file:./test.png]]
Is there a way of passing the export attributes to babel blocks in a way in
which from direct rendering of the document things work and I can adjust?
If now which part of the org mode codebase controls all of this?
Thanking you all in advance.
--
Juan Amiguet Vercher
Practising theorist
All-round geek
Polyglot polymath
+41(0)774867913
[-- Attachment #2: Type: text/html, Size: 1591 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Export attributes for babel blocks
2017-10-02 6:46 Export attributes for babel blocks Juan Amiguet
@ 2017-10-02 7:05 ` Thomas S. Dye
2017-10-02 7:10 ` Juan Amiguet
2017-10-02 10:26 ` Eric S Fraga
1 sibling, 1 reply; 5+ messages in thread
From: Thomas S. Dye @ 2017-10-02 7:05 UTC (permalink / raw)
To: Juan Amiguet; +Cc: emacs-orgmode
Aloha Juan Amiguet,
Juan Amiguet writes:
> Dear all,
>
> I have been having this issue for quite a while perhaps I am using the
> feature wrong and someone can enlighten me or perhaps someone can point me
> at the bit of code I can patch it myself.
> Here is the issue:
>
> I have a babel block such as
>
> #+begin_src dot :file test.png
> digraph test {
> A -> B
> }
> #+end_src
>
> This will create after execution a
>
> #+RESULT:
> [[file:./test.png]]
>
> Now if I would like have something like :width .5/.linewith as a attribute
> to the image the only I have found is to do the following
>
> #+begin_src dot :file test.png :exports none
> digraph test {
> A -> B
> }
> #+end_src
>
> #+attr_latex: width=.5/linewidth
> [[file:./test.png]]
>
> Is there a way of passing the export attributes to babel blocks in a way in
> which from direct rendering of the document things work and I can adjust?
> If now which part of the org mode codebase controls all of this?
>
> Thanking you all in advance.
Dot doesn't know anything about the linewidth you might be using in
LaTeX. LaTeX will take any image and reproduce it at .5/linewidth,
regardless of dot settings.
The :cmdline header argument for dot is documented here:
http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-dot.html
You can find links to the dot command line arguments. Babel gives you
full access to the dot command line.
hth,
Tom
--
Thomas S. Dye
http://www.tsdye.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Export attributes for babel blocks
2017-10-02 7:05 ` Thomas S. Dye
@ 2017-10-02 7:10 ` Juan Amiguet
0 siblings, 0 replies; 5+ messages in thread
From: Juan Amiguet @ 2017-10-02 7:10 UTC (permalink / raw)
To: Thomas S. Dye; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 2117 bytes --]
Thomas thank you for your answer,
I was thinking more of how to modify babel so that it would generate the
results block with the relevant exporter attribute parameters so that it
play nicely.
That is, the results block contains the directive it needs at the moment
the #+results block is bare and has no extra information for latex to pick
up and format correctly.
Kind regards.
--
Juan Amiguet Vercher
Practising theorist
All-round geek
Polyglot polymath
+41(0)774867913
On Mon, Oct 2, 2017 at 9:05 AM, Thomas S. Dye <tsd@tsdye.com> wrote:
> Aloha Juan Amiguet,
>
> Juan Amiguet writes:
>
> > Dear all,
> >
> > I have been having this issue for quite a while perhaps I am using the
> > feature wrong and someone can enlighten me or perhaps someone can point
> me
> > at the bit of code I can patch it myself.
> > Here is the issue:
> >
> > I have a babel block such as
> >
> > #+begin_src dot :file test.png
> > digraph test {
> > A -> B
> > }
> > #+end_src
> >
> > This will create after execution a
> >
> > #+RESULT:
> > [[file:./test.png]]
> >
> > Now if I would like have something like :width .5/.linewith as a
> attribute
> > to the image the only I have found is to do the following
> >
> > #+begin_src dot :file test.png :exports none
> > digraph test {
> > A -> B
> > }
> > #+end_src
> >
> > #+attr_latex: width=.5/linewidth
> > [[file:./test.png]]
> >
> > Is there a way of passing the export attributes to babel blocks in a way
> in
> > which from direct rendering of the document things work and I can adjust?
> > If now which part of the org mode codebase controls all of this?
> >
> > Thanking you all in advance.
>
> Dot doesn't know anything about the linewidth you might be using in
> LaTeX. LaTeX will take any image and reproduce it at .5/linewidth,
> regardless of dot settings.
>
> The :cmdline header argument for dot is documented here:
> http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-dot.html
>
> You can find links to the dot command line arguments. Babel gives you
> full access to the dot command line.
>
> hth,
> Tom
>
> --
> Thomas S. Dye
> http://www.tsdye.com
>
[-- Attachment #2: Type: text/html, Size: 3127 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Export attributes for babel blocks
2017-10-02 6:46 Export attributes for babel blocks Juan Amiguet
2017-10-02 7:05 ` Thomas S. Dye
@ 2017-10-02 10:26 ` Eric S Fraga
2017-10-02 12:23 ` Juan Amiguet
1 sibling, 1 reply; 5+ messages in thread
From: Eric S Fraga @ 2017-10-02 10:26 UTC (permalink / raw)
To: Juan Amiguet; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1498 bytes --]
On Monday, 2 Oct 2017 at 08:46, Juan Amiguet wrote:
> Dear all,
>
> I have been having this issue for quite a while perhaps I am using the
> feature wrong and someone can enlighten me or perhaps someone can point me
> at the bit of code I can patch it myself.
> Here is the issue:
>
> I have a babel block such as
>
> #+begin_src dot :file test.png
> digraph test {
> A -> B
> }
> #+end_src
>
>
> This will create after execution a
>
> #+RESULT:
> [[file:./test.png]]
>
> Now if I would like have something like :width .5/.linewith as a attribute
> to the image the only I have found is to do the following
>
> #+begin_src dot :file test.png :exports none
> digraph test {
> A -> B
> }
> #+end_src
>
> #+attr_latex: width=.5/linewidth
> [[file:./test.png]]
>
> Is there a way of passing the export attributes to babel blocks in a way in
> which from direct rendering of the document things work and I can adjust?
> If now which part of the org mode codebase controls all of this?
Simply add the attr_latex line to just before the #+result line and any
re-evaluation of the src block will work just fine. I.e.:
--8<---------------cut here---------------start------------->8---
#+begin_src dot :file test.png
digraph test {
A -> B
}
#+end_src
#+attr_latex: width=.5/linewidth
#+RESULT:
[[file:./test.png]]
--8<---------------cut here---------------end--------------->8---
--
: Eric S Fraga via Emacs 27.0.50, Org release_9.1.1-78-gfbf47c
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Export attributes for babel blocks
2017-10-02 10:26 ` Eric S Fraga
@ 2017-10-02 12:23 ` Juan Amiguet
0 siblings, 0 replies; 5+ messages in thread
From: Juan Amiguet @ 2017-10-02 12:23 UTC (permalink / raw)
To: Juan Amiguet, emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 2078 bytes --]
Eric,
Thanks a lot for your answer it works with the following updates
--8<---------------cut here---------------start------------->8---
#+begin_src dot :file test.png
digraph test {
A -> B
}
#+end_src
#+attr_latex: :width .5\linewidth
#+RESULTS:
[[file:test.png]]
--8<---------------cut here---------------end--------------->8---
Kind regards.
--
Juan Amiguet Vercher
Practising theorist
All-round geek
Polyglot polymath
+41(0)774867913
On Mon, Oct 2, 2017 at 12:26 PM, Eric S Fraga <esflists@gmail.com> wrote:
> On Monday, 2 Oct 2017 at 08:46, Juan Amiguet wrote:
> > Dear all,
> >
> > I have been having this issue for quite a while perhaps I am using the
> > feature wrong and someone can enlighten me or perhaps someone can point
> me
> > at the bit of code I can patch it myself.
> > Here is the issue:
> >
> > I have a babel block such as
> >
> > #+begin_src dot :file test.png
> > digraph test {
> > A -> B
> > }
> > #+end_src
> >
> >
> > This will create after execution a
> >
> > #+RESULT:
> > [[file:./test.png]]
> >
> > Now if I would like have something like :width .5/.linewith as a
> attribute
> > to the image the only I have found is to do the following
> >
> > #+begin_src dot :file test.png :exports none
> > digraph test {
> > A -> B
> > }
> > #+end_src
> >
> > #+attr_latex: width=.5/linewidth
> > [[file:./test.png]]
> >
> > Is there a way of passing the export attributes to babel blocks in a way
> in
> > which from direct rendering of the document things work and I can adjust?
> > If now which part of the org mode codebase controls all of this?
>
> Simply add the attr_latex line to just before the #+result line and any
> re-evaluation of the src block will work just fine. I.e.:
>
> --8<---------------cut here---------------start------------->8---
> #+begin_src dot :file test.png
> digraph test {
> A -> B
> }
> #+end_src
>
> #+attr_latex: width=.5/linewidth
> #+RESULT:
> [[file:./test.png]]
> --8<---------------cut here---------------end--------------->8---
>
> --
> : Eric S Fraga via Emacs 27.0.50, Org release_9.1.1-78-gfbf47c
>
[-- Attachment #2: Type: text/html, Size: 3079 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-10-02 12:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-02 6:46 Export attributes for babel blocks Juan Amiguet
2017-10-02 7:05 ` Thomas S. Dye
2017-10-02 7:10 ` Juan Amiguet
2017-10-02 10:26 ` Eric S Fraga
2017-10-02 12:23 ` Juan Amiguet
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.