Re: [O] [latex export/babel] pass arguments to \includegraphics from code blocks

2019-04-22 Thread Jakob Schöttl

Am 22.04.19 um 21:13 schrieb Nick Dokos:

Jakob Schöttl  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.




Re: [O] [latex export/babel] pass arguments to \includegraphics from code blocks

2019-04-22 Thread Nick Dokos
Jakob Schöttl  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




[O] [latex export/babel] pass arguments to \includegraphics from code blocks

2019-04-22 Thread Jakob Schöttl

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