emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How do I set attr_latex for the babel-block outputs?
@ 2020-05-25  4:47 Vladimir Nikishkin
  2020-05-27 11:05 ` Eric S Fraga
  0 siblings, 1 reply; 2+ messages in thread
From: Vladimir Nikishkin @ 2020-05-25  4:47 UTC (permalink / raw)
  To: emacs-orgmode

And the same question: I am drawing pictures for my book suing TikZ and babel.

This is my code (almost and mwe):

#+name: figure-1-2
#+header: :imagemagick yes :iminoptions -density 600 :imoutoptions -geometry 300
#+header: :fit yes :headers '("\\usepackage{tikz}")
#+header: :buffer on
#+begin_src latex :results value graphics file :exports both :file
figure-1-2-tree.png
\usetikzlibrary{trees}
\begin{tikzpicture}[color=gray]
\node {sqrt} % root
  child { node {sqrt-iter}
                  child[sibling distance=5cm] { node{ good-enough }
                          child[sibling distance=2cm] { node { square } }
                          child[sibling distance=2cm] { node { abs } } }
                  child { node{ improve }
                          child { node { average } } } };
\end{tikzpicture}
#+end_src

The #+RESULTS has a link
[file:figure-1-2-tree.png]]
below it.

However, after export the picture is rendered \textwidth-wide.

If I manually set
#+attr_latex: :width 8cm above the #+RESULTS, it is displayed as
expected, but If I recompute the picture, it is pasted above my
manually added attr line.

As far as I understand, the "graphics" Format is essentially
org-mode-text. Is it possible to set proper width attributes?


-- 
Yours sincerely, Vladimir Nikishkin


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

* Re: How do I set attr_latex for the babel-block outputs?
  2020-05-25  4:47 How do I set attr_latex for the babel-block outputs? Vladimir Nikishkin
@ 2020-05-27 11:05 ` Eric S Fraga
  0 siblings, 0 replies; 2+ messages in thread
From: Eric S Fraga @ 2020-05-27 11:05 UTC (permalink / raw)
  To: Vladimir Nikishkin; +Cc: emacs-orgmode

On Monday, 25 May 2020 at 12:47, Vladimir Nikishkin wrote:
> If I manually set #+attr_latex: :width 8cm above the #+RESULTS, it is
> displayed as expected, but If I recompute the picture, it is pasted
> above my manually added attr line.

Name your src block (using #+name:) and then the results block will also
be named and org babel will know where to place the new results.

-- 
: Eric S Fraga via Emacs 28.0.50, Org release_9.3.6-640-g9bc0cc


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

end of thread, other threads:[~2020-05-27 11:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-25  4:47 How do I set attr_latex for the babel-block outputs? Vladimir Nikishkin
2020-05-27 11:05 ` Eric S Fraga

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).