emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [latex export/babel] pass arguments to \includegraphics from code blocks
@ 2019-04-22 17:46 Jakob Schöttl
  2019-04-22 19:13 ` Nick Dokos
  0 siblings, 1 reply; 3+ messages in thread
From: Jakob Schöttl @ 2019-04-22 17:46 UTC (permalink / raw)
  To: emacs-orgmode

Hi, I want to use code blocks to generate and include images of sheet music:

#+BEGIN_SRC lilypond :file test.png :exports results
\header{tagline=""}
{ a b c }
#+END_SRC

When doing a latex export the result is:

\begin{center}
\includegraphics[width=.9\linewidth]{test.png}
\end{center}

Is there a way to specify the arguments for \includegraphics? For 
example I want to change the display width.

Putting these lines above the code block have no effect:

#+ATTR_LATEX: :width 4cm
#+CAPTION: xxx

Maybe this requires a change in ob-lilypond.el to introduce new header 
arguments for the source block?

Regards, Jakob

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

* Re: [latex export/babel] pass arguments to \includegraphics from code blocks
  2019-04-22 17:46 [latex export/babel] pass arguments to \includegraphics from code blocks Jakob Schöttl
@ 2019-04-22 19:13 ` Nick Dokos
  2019-04-22 20:33   ` Jakob Schöttl
  0 siblings, 1 reply; 3+ messages in thread
From: Nick Dokos @ 2019-04-22 19:13 UTC (permalink / raw)
  To: emacs-orgmode

Jakob Schöttl <jschoett@gmail.com> writes:

> Hi, I want to use code blocks to generate and include images of sheet music:
>
> #+BEGIN_SRC lilypond :file test.png :exports results
> \header{tagline=""}
> { a b c }
> #+END_SRC
>
>
> When doing a latex export the result is:
>
> \begin{center}
> \includegraphics[width=.9\linewidth]{test.png}
> \end{center}
>
> Is there a way to specify the arguments for \includegraphics? For 
> example I want to change the display width.
>
> Putting these lines above the code block have no effect:
>
> #+ATTR_LATEX: :width 4cm
>
> #+CAPTION: xxx
>
> Maybe this requires a change in ob-lilypond.el to introduce new header 
> arguments for the source block?
>

What I do in such cases is evaluate the block and then add the caption and
attribute line above the #+RESULTS line:

--8<---------------cut here---------------start------------->8---
#+BEGIN_SRC lilypond :file test.png :exports results
\header{tagline=""}
{ a b c }
#+END_SRC


#+ATTR_LATEX: :width 4cm
#+CAPTION: xxx
#+RESULTS:
[[file:test.png]]
--8<---------------cut here---------------end--------------->8---

-- 
Nick

"There are only two hard problems in computer science: cache
invalidation, naming things, and off-by-one errors." -Martin Fowler

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

* Re: [latex export/babel] pass arguments to \includegraphics from code blocks
  2019-04-22 19:13 ` Nick Dokos
@ 2019-04-22 20:33   ` Jakob Schöttl
  0 siblings, 0 replies; 3+ messages in thread
From: Jakob Schöttl @ 2019-04-22 20:33 UTC (permalink / raw)
  To: Nick Dokos, emacs-orgmode

Am 22.04.19 um 21:13 schrieb Nick Dokos:
> Jakob Schöttl <jschoett@gmail.com> writes:
>> Hi, I want to use code blocks to generate and include images of sheet music:
>>
>> #+BEGIN_SRC lilypond :file test.png :exports results
>> \header{tagline=""}
>> { a b c }
>> #+END_SRC
>>
>>
>> When doing a latex export the result is:
>>
>> \begin{center}
>> \includegraphics[width=.9\linewidth]{test.png}
>> \end{center}
>>
>> Is there a way to specify the arguments for \includegraphics? For
>> example I want to change the display width.
>>
>> Putting these lines above the code block have no effect:
>>
>> #+ATTR_LATEX: :width 4cm
>>
>> #+CAPTION: xxx
>>
>> Maybe this requires a change in ob-lilypond.el to introduce new header
>> arguments for the source block?
>>
> What I do in such cases is evaluate the block and then add the caption and
> attribute line above the #+RESULTS line:
>
> --8<---------------cut here---------------start------------->8---
> #+BEGIN_SRC lilypond :file test.png :exports results
> \header{tagline=""}
> { a b c }
> #+END_SRC
>
>
> #+ATTR_LATEX: :width 4cm
> #+CAPTION: xxx
> #+RESULTS:
> [[file:test.png]]
> --8<---------------cut here---------------end--------------->8---
>

Thank you, Nick! That's perfect.

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

end of thread, other threads:[~2019-04-22 20:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-22 17:46 [latex export/babel] pass arguments to \includegraphics from code blocks Jakob Schöttl
2019-04-22 19:13 ` Nick Dokos
2019-04-22 20:33   ` Jakob Schöttl

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