emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* TikZ to separate file (babel?) possible?
@ 2010-10-22 20:13 John Hendy
  2010-10-22 20:35 ` Erik Iverson
  2010-10-22 21:25 ` Eric Schulte
  0 siblings, 2 replies; 15+ messages in thread
From: John Hendy @ 2010-10-22 20:13 UTC (permalink / raw)
  To: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1140 bytes --]

Hi,


I've recently gotten into TikZ and love it. It is simply fantastic for
creating neat diagrams and other thingies.

One question... I created an org file with a flow chart in it and simply put
my TikZ code in between #+begin_latex and #+end_latex. This is fine when the
picture is in a document, but what if I want just a .png/jpg/eps/pdf output?
Is it possible to use babel or something else so that I can simply generate
a picture vs. needing it to be "in" the PDF output?

I can ask the PGF list as well, but this one is far more active and I know
some use TikZ here. I ask because sometimes in my notes I'd like to have the
code present but also be able to reuse my work elsewhere, like when I have
to present using powerpoint. It'd be nice to just grab the picture (like
what I do with gnuplot output) rather than generating a pdf just for the
TikZ pic, screenshot or gimp it down to size, and then be able to use it.

Does that make sense? It seems like babel would be perfect for this. It
already allows all the typical handles -- file output, what to export, etc.

Or does this already exist and I'm ignorant?


Thoughts?
John

[-- Attachment #1.2: Type: text/html, Size: 1355 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: TikZ to separate file (babel?) possible?
  2010-10-22 20:13 TikZ to separate file (babel?) possible? John Hendy
@ 2010-10-22 20:35 ` Erik Iverson
  2010-10-22 21:25 ` Eric Schulte
  1 sibling, 0 replies; 15+ messages in thread
From: Erik Iverson @ 2010-10-22 20:35 UTC (permalink / raw)
  To: John Hendy; +Cc: emacs-orgmode

John,

Does
http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-LaTeX.php#sec-4_2
help?  There is a tikz example there.  The :file argument may be all
you're missing, and putting your code in a latex source block.

Here is what I do when I have an R code block that generates
LaTeX code.  Hopefully this can be adapted to your case.

#+srcname: R-latex
#+begin_src R :results silent :exports code
   lf <- function() {
       "\\LaTeX"
   }

   lf()
#+end_src

#+begin_src latex :noweb yes :file (if (and (boundp 'htmlp) htmlp) 
"latex-logo-html.png" "latex-logo.png") :buffer (if (and (boundp 'htmlp) 
htmlp) "no" t)
<<R-latex()>>~is a high-quality typesetting system; it includes
features designed for the production of technical and scientific
documentation. <<R-latex()>>~is the de facto standard for the
communication and publication of scientific
documents. <<R-latex()>>~is available as free software.
#+end_src

That messy :file and :buffer arguments needs some explanation.

They are there so that when I eval the code block *in* an org-mode
buffer, with C-c C-c, that an image will be generated to be
inserted into the buffer.  However, this uses my background color
in emacs, which I don't actually want when exported to HTML, that's
what the :buffer argument controls.  Essentially, it's just
what arguments get passed to dvipng (if I recall correctly).

On Latex export, the actual latex code should be included in the
document, so I think all of my use cases are covered.

The only issue is that org-mode doesn't display PDFs generated
from a :file argument in buffer, but you might not care about
that.

If you're an R user, you might also check out the tikzDevice package:
http://r-forge.r-project.org/projects/tikzdevice/

HTH,
--Erik


John Hendy wrote:
> Hi,
> 
> 
> I've recently gotten into TikZ and love it. It is simply fantastic for 
> creating neat diagrams and other thingies.
> 
> One question... I created an org file with a flow chart in it and simply 
> put my TikZ code in between #+begin_latex and #+end_latex. This is fine 
> when the picture is in a document, but what if I want just a 
> .png/jpg/eps/pdf output? Is it possible to use babel or something else 
> so that I can simply generate a picture vs. needing it to be "in" the 
> PDF output?
> 
> I can ask the PGF list as well, but this one is far more active and I 
> know some use TikZ here. I ask because sometimes in my notes I'd like to 
> have the code present but also be able to reuse my work elsewhere, like 
> when I have to present using powerpoint. It'd be nice to just grab the 
> picture (like what I do with gnuplot output) rather than generating a 
> pdf just for the TikZ pic, screenshot or gimp it down to size, and then 
> be able to use it.
> 
> Does that make sense? It seems like babel would be perfect for this. It 
> already allows all the typical handles -- file output, what to export, etc.
> 
> Or does this already exist and I'm ignorant?
> 
> 
> Thoughts?
> John
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: TikZ to separate file (babel?) possible?
  2010-10-22 20:13 TikZ to separate file (babel?) possible? John Hendy
  2010-10-22 20:35 ` Erik Iverson
@ 2010-10-22 21:25 ` Eric Schulte
  2010-10-22 21:36   ` John Hendy
  1 sibling, 1 reply; 15+ messages in thread
From: Eric Schulte @ 2010-10-22 21:25 UTC (permalink / raw)
  To: John Hendy; +Cc: emacs-orgmode

Hi John,

I use blocks like the following to create standalone pdfs.

#+begin_src latex :file stuff/epr-logo.pdf :border 1.75em :packages '(("" "tikz")) :exports none
  \usetikzlibrary{shapes,arrows,shadows,decorations,decorations.text}
  \tikzstyle{line} = [draw, ultra thick, -latex']
  {\huge
    \begin{tikzpicture}[scale=0.5]
      \path
      [decorate,
      decoration={text along path,
        text={main(int argc, char *argv[]) int a; int b; if(a!=b) a++1;}}]
        (0,2) cos (3,0.5);
        \path
        [decorate,
        decoration={text along path,
          text={argc, char *argv[]) int a; int b; if(a!=b) a++1;}}]
        (4.5,-0.5) sin (8,-2) cos (12,0) sin (16,2) cos (19,0.5);
      \path
      [decorate,
      decoration={text along path,
        text={main(int argc, char *argv[]) int a; int b; if(a!=b) a++1;}}]
        (0,-2) cos (4,0) sin (8,2) cos (11,0.5);
      \path
      [decorate,
      decoration={text along path,
        text={[]) int a; int b; if(a!=b) a++1;}}]
      (12.5,-0.5) sin (16,-2) cos (20,0) sin (24,2);
      \path
      [decorate,
      decoration={text along path,
        text={if(a!=b) a++1;}}]
      (20.5,-0.5) sin (24,-2);
  \end{tikzpicture}
  }
#+end_src

I then normally use the convert command if I want to change the
resulting pdf into a png or other image type more suitable for web
publishing.

Best -- Eric

John Hendy <jw.hendy@gmail.com> writes:

> Hi,
>
>
> I've recently gotten into TikZ and love it. It is simply fantastic for
> creating neat diagrams and other thingies.
>
> One question... I created an org file with a flow chart in it and simply put
> my TikZ code in between #+begin_latex and #+end_latex. This is fine when the
> picture is in a document, but what if I want just a .png/jpg/eps/pdf output?
> Is it possible to use babel or something else so that I can simply generate
> a picture vs. needing it to be "in" the PDF output?
>
> I can ask the PGF list as well, but this one is far more active and I know
> some use TikZ here. I ask because sometimes in my notes I'd like to have the
> code present but also be able to reuse my work elsewhere, like when I have
> to present using powerpoint. It'd be nice to just grab the picture (like
> what I do with gnuplot output) rather than generating a pdf just for the
> TikZ pic, screenshot or gimp it down to size, and then be able to use it.
>
> Does that make sense? It seems like babel would be perfect for this. It
> already allows all the typical handles -- file output, what to export, etc.
>
> Or does this already exist and I'm ignorant?
>
>
> Thoughts?
> John
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: TikZ to separate file (babel?) possible?
  2010-10-22 21:25 ` Eric Schulte
@ 2010-10-22 21:36   ` John Hendy
  2010-10-22 23:11     ` Eric S Fraga
  0 siblings, 1 reply; 15+ messages in thread
From: John Hendy @ 2010-10-22 21:36 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 3269 bytes --]

This is fantastic. Honestly, I had no idea that one could use LaTeX with
babel! This is just perfect. I was googling around for "export tikz pgf jpg"
and things like that with no luck. This will do perfectly.

Thanks for the help.

John

On Fri, Oct 22, 2010 at 4:25 PM, Eric Schulte <schulte.eric@gmail.com>wrote:

> Hi John,
>
> I use blocks like the following to create standalone pdfs.
>
> #+begin_src latex :file stuff/epr-logo.pdf :border 1.75em :packages '((""
> "tikz")) :exports none
>  \usetikzlibrary{shapes,arrows,shadows,decorations,decorations.text}
>  \tikzstyle{line} = [draw, ultra thick, -latex']
>  {\huge
>    \begin{tikzpicture}[scale=0.5]
>      \path
>      [decorate,
>      decoration={text along path,
>        text={main(int argc, char *argv[]) int a; int b; if(a!=b) a++1;}}]
>        (0,2) cos (3,0.5);
>        \path
>        [decorate,
>        decoration={text along path,
>          text={argc, char *argv[]) int a; int b; if(a!=b) a++1;}}]
>        (4.5,-0.5) sin (8,-2) cos (12,0) sin (16,2) cos (19,0.5);
>      \path
>      [decorate,
>      decoration={text along path,
>        text={main(int argc, char *argv[]) int a; int b; if(a!=b) a++1;}}]
>        (0,-2) cos (4,0) sin (8,2) cos (11,0.5);
>      \path
>      [decorate,
>      decoration={text along path,
>        text={[]) int a; int b; if(a!=b) a++1;}}]
>      (12.5,-0.5) sin (16,-2) cos (20,0) sin (24,2);
>      \path
>      [decorate,
>      decoration={text along path,
>        text={if(a!=b) a++1;}}]
>      (20.5,-0.5) sin (24,-2);
>  \end{tikzpicture}
>  }
> #+end_src
>
> I then normally use the convert command if I want to change the
> resulting pdf into a png or other image type more suitable for web
> publishing.
>
> Best -- Eric
>
> John Hendy <jw.hendy@gmail.com> writes:
>
> > Hi,
> >
> >
> > I've recently gotten into TikZ and love it. It is simply fantastic for
> > creating neat diagrams and other thingies.
> >
> > One question... I created an org file with a flow chart in it and simply
> put
> > my TikZ code in between #+begin_latex and #+end_latex. This is fine when
> the
> > picture is in a document, but what if I want just a .png/jpg/eps/pdf
> output?
> > Is it possible to use babel or something else so that I can simply
> generate
> > a picture vs. needing it to be "in" the PDF output?
> >
> > I can ask the PGF list as well, but this one is far more active and I
> know
> > some use TikZ here. I ask because sometimes in my notes I'd like to have
> the
> > code present but also be able to reuse my work elsewhere, like when I
> have
> > to present using powerpoint. It'd be nice to just grab the picture (like
> > what I do with gnuplot output) rather than generating a pdf just for the
> > TikZ pic, screenshot or gimp it down to size, and then be able to use it.
> >
> > Does that make sense? It seems like babel would be perfect for this. It
> > already allows all the typical handles -- file output, what to export,
> etc.
> >
> > Or does this already exist and I'm ignorant?
> >
> >
> > Thoughts?
> > John
> > _______________________________________________
> > Emacs-orgmode mailing list
> > Please use `Reply All' to send replies to the list.
> > Emacs-orgmode@gnu.org
> > http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>

[-- Attachment #1.2: Type: text/html, Size: 4241 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: TikZ to separate file (babel?) possible?
  2010-10-22 21:36   ` John Hendy
@ 2010-10-22 23:11     ` Eric S Fraga
  2010-10-23 17:58       ` John Hendy
  0 siblings, 1 reply; 15+ messages in thread
From: Eric S Fraga @ 2010-10-22 23:11 UTC (permalink / raw)
  To: John Hendy; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 610 bytes --]

On Fri, 22 Oct 2010 16:36:10 -0500, John Hendy <jw.hendy@gmail.com> wrote:

> This is fantastic. Honestly, I had no idea that one could use LaTeX with
> babel! This is just perfect. I was googling around for "export tikz pgf jpg"
> and things like that with no luck. This will do perfectly.

For completeness (and the mailing list archive), if you need to do
this directly in latex, you will want to use the minimal document
class and the preview package.  Check out examples on the tikz
examples web site [1].  The preview package is what babel uses.

Footnotes: 
[1]  http://www.texample.net/tikz/examples/


[-- Attachment #2: Type: text/plain, Size: 75 bytes --]

-- 
Eric S Fraga
GnuPG: 8F5C 279D 3907 E14A 5C29  570D C891 93D8 FFFC F67D

[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: TikZ to separate file (babel?) possible?
  2010-10-22 23:11     ` Eric S Fraga
@ 2010-10-23 17:58       ` John Hendy
  2010-10-25 18:21         ` John Hendy
  0 siblings, 1 reply; 15+ messages in thread
From: John Hendy @ 2010-10-23 17:58 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 975 bytes --]

Thanks, Eric F. Got the preview package going and this is *exactly* what I
would have been looking for.

Eric S: yes, ImageMagick will take care of the rest :)


Thanks all!
John

On Fri, Oct 22, 2010 at 6:11 PM, Eric S Fraga <ucecesf@ucl.ac.uk> wrote:

> On Fri, 22 Oct 2010 16:36:10 -0500, John Hendy <jw.hendy@gmail.com> wrote:
>
> > This is fantastic. Honestly, I had no idea that one could use LaTeX with
> > babel! This is just perfect. I was googling around for "export tikz pgf
> jpg"
> > and things like that with no luck. This will do perfectly.
>
> For completeness (and the mailing list archive), if you need to do
> this directly in latex, you will want to use the minimal document
> class and the preview package.  Check out examples on the tikz
> examples web site [1].  The preview package is what babel uses.
>
> Footnotes:
> [1]  http://www.texample.net/tikz/examples/
>
>
> --
> Eric S Fraga
> GnuPG: 8F5C 279D 3907 E14A 5C29  570D C891 93D8 FFFC F67D
>
>

[-- Attachment #1.2: Type: text/html, Size: 1491 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: TikZ to separate file (babel?) possible?
  2010-10-23 17:58       ` John Hendy
@ 2010-10-25 18:21         ` John Hendy
  2010-10-25 18:53           ` Eric Schulte
  0 siblings, 1 reply; 15+ messages in thread
From: John Hendy @ 2010-10-25 18:21 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 2508 bytes --]

Followup question. I have an existing diagram I had already exported to PDF
via LaTeX, taken a screenshot of, and used in a presentation. I tried the
same diagram with the new method and am having issues with the font. The
original org file is like this:

*---( File_1.org -> embedded LaTeX )---*
#+latex_header: \usepackage{tikz} \usetikzlibrary{shapes,positioning,arrows}
#+latex_header: \usepackage[hmargin=2.5cm,vmargin=2.5cm]{geometry}
#+latex_header: \usepackage{lmodern}
#+latex_header: \renewcommand{\rmdefault}{cmss}

* Section

#+begin_latex

+++ TikZ code is here +++

#+end_latex

*---( End File_1.org )---*


My file using this new method is like this:

*---( File_2.org -> exports TikZ to separate PDF via babel/LaTeX )---*
#+latex_header: \usepackage{tikz} \usetikzlibrary{shapes,positioning,arrows}
#+latex_header: \usepackage[hmargin=2.5cm,vmargin=2.5cm]{geometry}
#+latex_header: \usepackage{lmodern}
#+latex_header: \renewcommand{\rmdefault}{cmss}

* Section

#+begin_src latex :file flow-chart.pdf :packages '(("" "tikz")) :border 1em

+++ TikZ code is here +++

#+end_src

*---( End File_2.org )---*


In my first file, the entire font is latin modern (sans-serif). Header,
title, author, *and* all TikZ diagram text.

In the second, only the header is (if I export the whole thing), but not the
text in my TikZ nodes. Why is the babel block ignoring the document font
setting?


Thanks,
John


On Sat, Oct 23, 2010 at 12:58 PM, John Hendy <jw.hendy@gmail.com> wrote:

> Thanks, Eric F. Got the preview package going and this is *exactly* what I
> would have been looking for.
>
> Eric S: yes, ImageMagick will take care of the rest :)
>
>
> Thanks all!
> John
>
> On Fri, Oct 22, 2010 at 6:11 PM, Eric S Fraga <ucecesf@ucl.ac.uk> wrote:
>
>> On Fri, 22 Oct 2010 16:36:10 -0500, John Hendy <jw.hendy@gmail.com>
>> wrote:
>>
>> > This is fantastic. Honestly, I had no idea that one could use LaTeX with
>> > babel! This is just perfect. I was googling around for "export tikz pgf
>> jpg"
>> > and things like that with no luck. This will do perfectly.
>>
>> For completeness (and the mailing list archive), if you need to do
>> this directly in latex, you will want to use the minimal document
>> class and the preview package.  Check out examples on the tikz
>> examples web site [1].  The preview package is what babel uses.
>>
>> Footnotes:
>> [1]  http://www.texample.net/tikz/examples/
>>
>>
>> --
>> Eric S Fraga
>> GnuPG: 8F5C 279D 3907 E14A 5C29  570D C891 93D8 FFFC F67D
>>
>>
>

[-- Attachment #1.2: Type: text/html, Size: 4022 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: TikZ to separate file (babel?) possible?
  2010-10-25 18:21         ` John Hendy
@ 2010-10-25 18:53           ` Eric Schulte
  2010-10-25 18:58             ` John Hendy
  0 siblings, 1 reply; 15+ messages in thread
From: Eric Schulte @ 2010-10-25 18:53 UTC (permalink / raw)
  To: John Hendy; +Cc: emacs-orgmode

Hi John,

In the case you describe I would export the *code* of the tikz latex
block rather than the file resulting from evaluating the block.

This is possible by adding the following header argument to the code
block which will evaluate the latex block when the export target is not
latex and will just export the code when the target is latex.

  :exports (if latexp "code" "results")

Best -- Eric

John Hendy <jw.hendy@gmail.com> writes:

> Followup question. I have an existing diagram I had already exported to PDF
> via LaTeX, taken a screenshot of, and used in a presentation. I tried the
> same diagram with the new method and am having issues with the font. The
> original org file is like this:
>
> *---( File_1.org -> embedded LaTeX )---*
> #+latex_header: \usepackage{tikz} \usetikzlibrary{shapes,positioning,arrows}
> #+latex_header: \usepackage[hmargin=2.5cm,vmargin=2.5cm]{geometry}
> #+latex_header: \usepackage{lmodern}
> #+latex_header: \renewcommand{\rmdefault}{cmss}
>
> * Section
>
> #+begin_latex
>
> +++ TikZ code is here +++
>
> #+end_latex
>
> *---( End File_1.org )---*
>
>
> My file using this new method is like this:
>
> *---( File_2.org -> exports TikZ to separate PDF via babel/LaTeX )---*
> #+latex_header: \usepackage{tikz} \usetikzlibrary{shapes,positioning,arrows}
> #+latex_header: \usepackage[hmargin=2.5cm,vmargin=2.5cm]{geometry}
> #+latex_header: \usepackage{lmodern}
> #+latex_header: \renewcommand{\rmdefault}{cmss}
>
> * Section
>
> #+begin_src latex :file flow-chart.pdf :packages '(("" "tikz")) :border 1em
>
> +++ TikZ code is here +++
>
> #+end_src
>
> *---( End File_2.org )---*
>
>
> In my first file, the entire font is latin modern (sans-serif). Header,
> title, author, *and* all TikZ diagram text.
>
> In the second, only the header is (if I export the whole thing), but not the
> text in my TikZ nodes. Why is the babel block ignoring the document font
> setting?
>
>
> Thanks,
> John
>
>
> On Sat, Oct 23, 2010 at 12:58 PM, John Hendy <jw.hendy@gmail.com> wrote:
>
>> Thanks, Eric F. Got the preview package going and this is *exactly* what I
>> would have been looking for.
>>
>> Eric S: yes, ImageMagick will take care of the rest :)
>>
>>
>> Thanks all!
>> John
>>
>> On Fri, Oct 22, 2010 at 6:11 PM, Eric S Fraga <ucecesf@ucl.ac.uk> wrote:
>>
>>> On Fri, 22 Oct 2010 16:36:10 -0500, John Hendy <jw.hendy@gmail.com>
>>> wrote:
>>>
>>> > This is fantastic. Honestly, I had no idea that one could use LaTeX with
>>> > babel! This is just perfect. I was googling around for "export tikz pgf
>>> jpg"
>>> > and things like that with no luck. This will do perfectly.
>>>
>>> For completeness (and the mailing list archive), if you need to do
>>> this directly in latex, you will want to use the minimal document
>>> class and the preview package.  Check out examples on the tikz
>>> examples web site [1].  The preview package is what babel uses.
>>>
>>> Footnotes:
>>> [1]  http://www.texample.net/tikz/examples/
>>>
>>>
>>> --
>>> Eric S Fraga
>>> GnuPG: 8F5C 279D 3907 E14A 5C29  570D C891 93D8 FFFC F67D
>>>
>>>
>>

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

* Re: TikZ to separate file (babel?) possible?
  2010-10-25 18:53           ` Eric Schulte
@ 2010-10-25 18:58             ` John Hendy
  2010-10-26  8:17               ` Eric S Fraga
  0 siblings, 1 reply; 15+ messages in thread
From: John Hendy @ 2010-10-25 18:58 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 3964 bytes --]

On Mon, Oct 25, 2010 at 1:53 PM, Eric Schulte <schulte.eric@gmail.com>wrote:

> Hi John,
>
> In the case you describe I would export the *code* of the tikz latex
> block rather than the file resulting from evaluating the block.
>
>
Code = raw LaTeX/TikZ code? If so, I don't really care about that. i just
want the graphic.


> This is possible by adding the following header argument to the code
> block which will evaluate the latex block when the export target is not
> latex and will just export the code when the target is latex.
>
>  :exports (if latexp "code" "results")
>

When trying C-c C-c after adding this, I get "Symbol's value as variable is
void: latexp" in the minibuffer.

Also, does this assist with my font issue? My main question is how to get
the document font to apply to my babel block. At present, the code shown
above for file_2.org is *perfect* in its behavior (I get a perfectly cropped
PDF of my diagram) except for it not being the right font. I just need to
know to set the font for the TikZ babel output.


Thanks for the assistance,
John


>
> Best -- Eric
>
> John Hendy <jw.hendy@gmail.com> writes:
>
> > Followup question. I have an existing diagram I had already exported to
> PDF
> > via LaTeX, taken a screenshot of, and used in a presentation. I tried the
> > same diagram with the new method and am having issues with the font. The
> > original org file is like this:
> >
> > *---( File_1.org -> embedded LaTeX )---*
> > #+latex_header: \usepackage{tikz}
> \usetikzlibrary{shapes,positioning,arrows}
> > #+latex_header: \usepackage[hmargin=2.5cm,vmargin=2.5cm]{geometry}
> > #+latex_header: \usepackage{lmodern}
> > #+latex_header: \renewcommand{\rmdefault}{cmss}
> >
> > * Section
> >
> > #+begin_latex
> >
> > +++ TikZ code is here +++
> >
> > #+end_latex
> >
> > *---( End File_1.org )---*
> >
> >
> > My file using this new method is like this:
> >
> > *---( File_2.org -> exports TikZ to separate PDF via babel/LaTeX )---*
> > #+latex_header: \usepackage{tikz}
> \usetikzlibrary{shapes,positioning,arrows}
> > #+latex_header: \usepackage[hmargin=2.5cm,vmargin=2.5cm]{geometry}
> > #+latex_header: \usepackage{lmodern}
> > #+latex_header: \renewcommand{\rmdefault}{cmss}
> >
> > * Section
> >
> > #+begin_src latex :file flow-chart.pdf :packages '(("" "tikz")) :border
> 1em
> >
> > +++ TikZ code is here +++
> >
> > #+end_src
> >
> > *---( End File_2.org )---*
> >
> >
> > In my first file, the entire font is latin modern (sans-serif). Header,
> > title, author, *and* all TikZ diagram text.
> >
> > In the second, only the header is (if I export the whole thing), but not
> the
> > text in my TikZ nodes. Why is the babel block ignoring the document font
> > setting?
> >
> >
> > Thanks,
> > John
> >
> >
> > On Sat, Oct 23, 2010 at 12:58 PM, John Hendy <jw.hendy@gmail.com> wrote:
> >
> >> Thanks, Eric F. Got the preview package going and this is *exactly* what
> I
> >> would have been looking for.
> >>
> >> Eric S: yes, ImageMagick will take care of the rest :)
> >>
> >>
> >> Thanks all!
> >> John
> >>
> >> On Fri, Oct 22, 2010 at 6:11 PM, Eric S Fraga <ucecesf@ucl.ac.uk>
> wrote:
> >>
> >>> On Fri, 22 Oct 2010 16:36:10 -0500, John Hendy <jw.hendy@gmail.com>
> >>> wrote:
> >>>
> >>> > This is fantastic. Honestly, I had no idea that one could use LaTeX
> with
> >>> > babel! This is just perfect. I was googling around for "export tikz
> pgf
> >>> jpg"
> >>> > and things like that with no luck. This will do perfectly.
> >>>
> >>> For completeness (and the mailing list archive), if you need to do
> >>> this directly in latex, you will want to use the minimal document
> >>> class and the preview package.  Check out examples on the tikz
> >>> examples web site [1].  The preview package is what babel uses.
> >>>
> >>> Footnotes:
> >>> [1]  http://www.texample.net/tikz/examples/
> >>>
> >>>
> >>> --
> >>> Eric S Fraga
> >>> GnuPG: 8F5C 279D 3907 E14A 5C29  570D C891 93D8 FFFC F67D
> >>>
> >>>
> >>
>

[-- Attachment #1.2: Type: text/html, Size: 5724 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: TikZ to separate file (babel?) possible?
  2010-10-25 18:58             ` John Hendy
@ 2010-10-26  8:17               ` Eric S Fraga
  2010-10-26 14:34                 ` John Hendy
  0 siblings, 1 reply; 15+ messages in thread
From: Eric S Fraga @ 2010-10-26  8:17 UTC (permalink / raw)
  To: John Hendy; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 974 bytes --]

On Mon, 25 Oct 2010 13:58:41 -0500, John Hendy <jw.hendy@gmail.com> wrote:
> 
> [1  <text/plain; ISO-8859-1 (7bit)>]
> 
> [2  <text/html; ISO-8859-1 (quoted-printable)>]
> On Mon, Oct 25, 2010 at 1:53 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
> 
>     Hi John,
>    
>     In the case you describe I would export the *code* of the tikz latex
>     block rather than the file resulting from evaluating the block.
> 
> Code = raw LaTeX/TikZ code? If so, I don't really care about that. i just want the graphic.

Yes but the point is that, if I understand the processes involved
correctly, the export and babel routes each generate different latex
code.  Babel does *not* look at the document wide settings whereas
export does.  This is why Eric is suggesting you export the babel code
so that it is interpreted by the latex document that results from
exporting the whole org document.  Otherwise, make sure the settings
you want are within the latex source code block?

[-- Attachment #2: Type: text/plain, Size: 75 bytes --]

-- 
Eric S Fraga
GnuPG: 8F5C 279D 3907 E14A 5C29  570D C891 93D8 FFFC F67D

[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: TikZ to separate file (babel?) possible?
  2010-10-26  8:17               ` Eric S Fraga
@ 2010-10-26 14:34                 ` John Hendy
  2010-10-26 21:34                   ` John Hendy
  0 siblings, 1 reply; 15+ messages in thread
From: John Hendy @ 2010-10-26 14:34 UTC (permalink / raw)
  To: e.fraga; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 3110 bytes --]

On Tue, Oct 26, 2010 at 3:17 AM, Eric S Fraga <ucecesf@ucl.ac.uk> wrote:

> On Mon, 25 Oct 2010 13:58:41 -0500, John Hendy <jw.hendy@gmail.com> wrote:
> >
> > [1  <text/plain; ISO-8859-1 (7bit)>]
> >
> > [2  <text/html; ISO-8859-1 (quoted-printable)>]
> > On Mon, Oct 25, 2010 at 1:53 PM, Eric Schulte <schulte.eric@gmail.com>
> wrote:
> >
> >     Hi John,
> >
> >     In the case you describe I would export the *code* of the tikz latex
> >     block rather than the file resulting from evaluating the block.
> >
> > Code = raw LaTeX/TikZ code? If so, I don't really care about that. i just
> want the graphic.
>
> Yes but the point is that, if I understand the processes involved
> correctly, the export and babel routes each generate different latex
> code.  Babel does *not* look at the document wide settings whereas
> export does.  This is why Eric is suggesting you export the babel code
> so that it is interpreted by the latex document that results from
> exporting the whole org document.  Otherwise, make sure the settings
> you want are within the latex source code block?
>

That makes more sense, though if I export the code into the larger LaTeX
document, I'm left where I started, I believe. An 8.5x11 exported PDF with
my diagram in the middle of it.

If it's just getting the right code into the babel block, that's helpful to
know. Perhaps the easiest way to put it is this: what is the best path to
obtain the following:

- a single pdf output of my TikZ diagram, cropped to fit the diagram
- the font used in the TikZ diagram that I desire (preferably from the doc)

Again, my use-case is one in which I have daily notes or a paper with a
diagram but also would like to preserve the diagram for reuse. With babel,
it appears this should be possible -- I can both export normally and have
the graphic in the paper or send the TikZ section alone to export and use
the graphic in a presentation or elsewhere.

I wondered about what you said re. putting the settings in the latex source
code block, and I was actually fiddling around with that yesterday. My font
is simply set like so (present in the examples I posted earlier):

#+latex_header: \usepackage{lmodern}
#+latex_header: \renewcommand{\rmdefault}{cmss}

But I tried putting variations of this in the babel block (without the
#+latex_header part, of course) with no success.

These didn't work for me:

#+begin_src latex :file flow-chart.pdf :packages '(("" "tikz")) :border 1em
\usepackage{lmodern}
\renewcommand{\rmdefault}{cmss}

or

#+begin_src latex :file flow-chart.pdf :packages '(("" "tikz" "lmodern"))
:border 1em
\renewcommand{\rmdefault}{cmss}

or

#+begin_src latex :file flow-chart.pdf :packages '(("" "tikz lmodern"))
:border 1em
\renewcommand{\rmdefault}{cmss}

I haven't found anything at ob-doc-latex covering how to pass package
arguments or include LaTeX settings directly in the babel block. My attempts
at the renewcommand end up with "cmss" ending up in my TIkZ graphic
somewhere...


Thanks for persisting with me!
John





> --
> Eric S Fraga
> GnuPG: 8F5C 279D 3907 E14A 5C29  570D C891 93D8 FFFC F67D
>
>

[-- Attachment #1.2: Type: text/html, Size: 4859 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: TikZ to separate file (babel?) possible?
  2010-10-26 14:34                 ` John Hendy
@ 2010-10-26 21:34                   ` John Hendy
  2010-10-26 23:01                     ` Eric Schulte
  0 siblings, 1 reply; 15+ messages in thread
From: John Hendy @ 2010-10-26 21:34 UTC (permalink / raw)
  To: e.fraga; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 3702 bytes --]

Maybe it would just be easier if someone attached a .org file that functions
as you think would work well -- with both the document and the babel/TikZ
export having the same sans-serif font. Perhaps then I could simply C-e p
the document and C-c C-c the babel block myself to examine how it behaves?

I was not able to get the conditional :export code provided to work.

Thanks,
John

On Tue, Oct 26, 2010 at 9:34 AM, John Hendy <jw.hendy@gmail.com> wrote:

> On Tue, Oct 26, 2010 at 3:17 AM, Eric S Fraga <ucecesf@ucl.ac.uk> wrote:
>
>> On Mon, 25 Oct 2010 13:58:41 -0500, John Hendy <jw.hendy@gmail.com>
>> wrote:
>> >
>> > [1  <text/plain; ISO-8859-1 (7bit)>]
>> >
>> > [2  <text/html; ISO-8859-1 (quoted-printable)>]
>> > On Mon, Oct 25, 2010 at 1:53 PM, Eric Schulte <schulte.eric@gmail.com>
>> wrote:
>> >
>> >     Hi John,
>> >
>> >     In the case you describe I would export the *code* of the tikz latex
>> >     block rather than the file resulting from evaluating the block.
>> >
>> > Code = raw LaTeX/TikZ code? If so, I don't really care about that. i
>> just want the graphic.
>>
>> Yes but the point is that, if I understand the processes involved
>> correctly, the export and babel routes each generate different latex
>> code.  Babel does *not* look at the document wide settings whereas
>> export does.  This is why Eric is suggesting you export the babel code
>> so that it is interpreted by the latex document that results from
>> exporting the whole org document.  Otherwise, make sure the settings
>> you want are within the latex source code block?
>>
>
> That makes more sense, though if I export the code into the larger LaTeX
> document, I'm left where I started, I believe. An 8.5x11 exported PDF with
> my diagram in the middle of it.
>
> If it's just getting the right code into the babel block, that's helpful to
> know. Perhaps the easiest way to put it is this: what is the best path to
> obtain the following:
>
> - a single pdf output of my TikZ diagram, cropped to fit the diagram
> - the font used in the TikZ diagram that I desire (preferably from the doc)
>
> Again, my use-case is one in which I have daily notes or a paper with a
> diagram but also would like to preserve the diagram for reuse. With babel,
> it appears this should be possible -- I can both export normally and have
> the graphic in the paper or send the TikZ section alone to export and use
> the graphic in a presentation or elsewhere.
>
> I wondered about what you said re. putting the settings in the latex source
> code block, and I was actually fiddling around with that yesterday. My font
> is simply set like so (present in the examples I posted earlier):
>
> #+latex_header: \usepackage{lmodern}
> #+latex_header: \renewcommand{\rmdefault}{cmss}
>
> But I tried putting variations of this in the babel block (without the
> #+latex_header part, of course) with no success.
>
> These didn't work for me:
>
> #+begin_src latex :file flow-chart.pdf :packages '(("" "tikz")) :border 1em
> \usepackage{lmodern}
> \renewcommand{\rmdefault}{cmss}
>
> or
>
> #+begin_src latex :file flow-chart.pdf :packages '(("" "tikz" "lmodern"))
> :border 1em
> \renewcommand{\rmdefault}{cmss}
>
> or
>
> #+begin_src latex :file flow-chart.pdf :packages '(("" "tikz lmodern"))
> :border 1em
> \renewcommand{\rmdefault}{cmss}
>
> I haven't found anything at ob-doc-latex covering how to pass package
> arguments or include LaTeX settings directly in the babel block. My attempts
> at the renewcommand end up with "cmss" ending up in my TIkZ graphic
> somewhere...
>
>
> Thanks for persisting with me!
> John
>
>
>
>
>
>> --
>> Eric S Fraga
>> GnuPG: 8F5C 279D 3907 E14A 5C29  570D C891 93D8 FFFC F67D
>>
>>
>

[-- Attachment #1.2: Type: text/html, Size: 5406 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: TikZ to separate file (babel?) possible?
  2010-10-26 21:34                   ` John Hendy
@ 2010-10-26 23:01                     ` Eric Schulte
  2010-10-28 21:43                       ` John Hendy
  0 siblings, 1 reply; 15+ messages in thread
From: Eric Schulte @ 2010-10-26 23:01 UTC (permalink / raw)
  To: John Hendy; +Cc: emacs-orgmode

Hi,

First my previously pasted :exports code will throw errors on
interactive evaluation (i.e. when not exporting), this alternative
should be more robust.

 :exports (if (and (boundp 'latexp) latexp) "code" "results")

As for placing latex headers in a latex code block, I don't believe that
is currently possible.  I do agree it would be nice for latex code
blocks to inherit latex headers from the containing Org-mode buffer but
that would be a non-trivial piece of development, which I just don't
have time for at the moment.

I've just added a :headers argument which should allow changing things
like fonts that need to take place in the headers portion of the latex
file.  See the following examples, passing both a single header and a
list of headers.

--8<---------------cut here---------------start------------->8---
#+begin_src latex :headers \usepackage{lmodern} :file name1.pdf
  Eric Schulte
#+end_src

#+results:
[[file:name1.pdf]]

#+begin_src latex :headers '("\\usepackage{mathpazo}" "\\usepackage{fullpage}") :file name2.pdf
  Eric Schulte
#+end_src

#+results:
[[file:name2.pdf]]
--8<---------------cut here---------------end--------------->8---

Please pull this down and let me know if it works for you.

Best -- Eric

John Hendy <jw.hendy@gmail.com> writes:

> Maybe it would just be easier if someone attached a .org file that functions
> as you think would work well -- with both the document and the babel/TikZ
> export having the same sans-serif font. Perhaps then I could simply C-e p
> the document and C-c C-c the babel block myself to examine how it behaves?
>
> I was not able to get the conditional :export code provided to work.
>
> Thanks,
> John
>
> On Tue, Oct 26, 2010 at 9:34 AM, John Hendy <jw.hendy@gmail.com> wrote:
>
>> On Tue, Oct 26, 2010 at 3:17 AM, Eric S Fraga <ucecesf@ucl.ac.uk> wrote:
>>
>>> On Mon, 25 Oct 2010 13:58:41 -0500, John Hendy <jw.hendy@gmail.com>
>>> wrote:
>>> >
>>> > [1  <text/plain; ISO-8859-1 (7bit)>]
>>> >
>>> > [2  <text/html; ISO-8859-1 (quoted-printable)>]
>>> > On Mon, Oct 25, 2010 at 1:53 PM, Eric Schulte <schulte.eric@gmail.com>
>>> wrote:
>>> >
>>> >     Hi John,
>>> >
>>> >     In the case you describe I would export the *code* of the tikz latex
>>> >     block rather than the file resulting from evaluating the block.
>>> >
>>> > Code = raw LaTeX/TikZ code? If so, I don't really care about that. i
>>> just want the graphic.
>>>
>>> Yes but the point is that, if I understand the processes involved
>>> correctly, the export and babel routes each generate different latex
>>> code.  Babel does *not* look at the document wide settings whereas
>>> export does.  This is why Eric is suggesting you export the babel code
>>> so that it is interpreted by the latex document that results from
>>> exporting the whole org document.  Otherwise, make sure the settings
>>> you want are within the latex source code block?
>>>
>>
>> That makes more sense, though if I export the code into the larger LaTeX
>> document, I'm left where I started, I believe. An 8.5x11 exported PDF with
>> my diagram in the middle of it.
>>
>> If it's just getting the right code into the babel block, that's helpful to
>> know. Perhaps the easiest way to put it is this: what is the best path to
>> obtain the following:
>>
>> - a single pdf output of my TikZ diagram, cropped to fit the diagram
>> - the font used in the TikZ diagram that I desire (preferably from the doc)
>>
>> Again, my use-case is one in which I have daily notes or a paper with a
>> diagram but also would like to preserve the diagram for reuse. With babel,
>> it appears this should be possible -- I can both export normally and have
>> the graphic in the paper or send the TikZ section alone to export and use
>> the graphic in a presentation or elsewhere.
>>
>> I wondered about what you said re. putting the settings in the latex source
>> code block, and I was actually fiddling around with that yesterday. My font
>> is simply set like so (present in the examples I posted earlier):
>>
>> #+latex_header: \usepackage{lmodern}
>> #+latex_header: \renewcommand{\rmdefault}{cmss}
>>
>> But I tried putting variations of this in the babel block (without the
>> #+latex_header part, of course) with no success.
>>
>> These didn't work for me:
>>
>> #+begin_src latex :file flow-chart.pdf :packages '(("" "tikz")) :border 1em
>> \usepackage{lmodern}
>> \renewcommand{\rmdefault}{cmss}
>>
>> or
>>
>> #+begin_src latex :file flow-chart.pdf :packages '(("" "tikz" "lmodern"))
>> :border 1em
>> \renewcommand{\rmdefault}{cmss}
>>
>> or
>>
>> #+begin_src latex :file flow-chart.pdf :packages '(("" "tikz lmodern"))
>> :border 1em
>> \renewcommand{\rmdefault}{cmss}
>>
>> I haven't found anything at ob-doc-latex covering how to pass package
>> arguments or include LaTeX settings directly in the babel block. My attempts
>> at the renewcommand end up with "cmss" ending up in my TIkZ graphic
>> somewhere...
>>
>>
>> Thanks for persisting with me!
>> John
>>
>>
>>
>>
>>
>>> --
>>> Eric S Fraga
>>> GnuPG: 8F5C 279D 3907 E14A 5C29  570D C891 93D8 FFFC F67D
>>>
>>>
>>

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

* Re: TikZ to separate file (babel?) possible?
  2010-10-26 23:01                     ` Eric Schulte
@ 2010-10-28 21:43                       ` John Hendy
  2010-10-28 21:52                         ` John Hendy
  0 siblings, 1 reply; 15+ messages in thread
From: John Hendy @ 2010-10-28 21:43 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 5852 bytes --]

On Tue, Oct 26, 2010 at 6:01 PM, Eric Schulte <schulte.eric@gmail.com>wrote:

> Hi,
>
> First my previously pasted :exports code will throw errors on
> interactive evaluation (i.e. when not exporting), this alternative
> should be more robust.
>
>  :exports (if (and (boundp 'latexp) latexp) "code" "results")
>
> As for placing latex headers in a latex code block, I don't believe that
> is currently possible.  I do agree it would be nice for latex code
> blocks to inherit latex headers from the containing Org-mode buffer but
> that would be a non-trivial piece of development, which I just don't
> have time for at the moment.
>
> I've just added a :headers argument which should allow changing things
> like fonts that need to take place in the headers portion of the latex
> file.  See the following examples, passing both a single header and a
> list of headers.
>
 --8<---------------cut here---------------start------------->8---

> #+begin_src latex :headers \usepackage{lmodern} :file name1.pdf
>  Eric Schulte
> #+end_src
>
> #+results:
> [[file:name1.pdf]]
>
> #+begin_src latex :headers '("\\usepackage{mathpazo}"
> "\\usepackage{fullpage}") :file name2.pdf
>  Eric Schulte
> #+end_src
>
> #+results:
> [[file:name2.pdf]]
> --8<---------------cut here---------------end--------------->8---
>
> Please pull this down and let me know if it works for you.
>
>
Just pulled, make clean && make && make doc && make install. Tried it and I
get the default font for the first and Palatino for the second, but the
lmodern is not appearing to change what's going on. I tried what usually
works for me:

\renewcommand{\rmdefault}{cmss}

and this did not work to make it sans serif. Am I doing something wrong?


Thanks,
John



> Best -- Eric
>
> John Hendy <jw.hendy@gmail.com> writes:
>
> > Maybe it would just be easier if someone attached a .org file that
> functions
> > as you think would work well -- with both the document and the babel/TikZ
> > export having the same sans-serif font. Perhaps then I could simply C-e p
> > the document and C-c C-c the babel block myself to examine how it
> behaves?
> >
> > I was not able to get the conditional :export code provided to work.
> >
> > Thanks,
> > John
> >
> > On Tue, Oct 26, 2010 at 9:34 AM, John Hendy <jw.hendy@gmail.com> wrote:
> >
> >> On Tue, Oct 26, 2010 at 3:17 AM, Eric S Fraga <ucecesf@ucl.ac.uk>
> wrote:
> >>
> >>> On Mon, 25 Oct 2010 13:58:41 -0500, John Hendy <jw.hendy@gmail.com>
> >>> wrote:
> >>> >
> >>> > [1  <text/plain; ISO-8859-1 (7bit)>]
> >>> >
> >>> > [2  <text/html; ISO-8859-1 (quoted-printable)>]
> >>> > On Mon, Oct 25, 2010 at 1:53 PM, Eric Schulte <
> schulte.eric@gmail.com>
> >>> wrote:
> >>> >
> >>> >     Hi John,
> >>> >
> >>> >     In the case you describe I would export the *code* of the tikz
> latex
> >>> >     block rather than the file resulting from evaluating the block.
> >>> >
> >>> > Code = raw LaTeX/TikZ code? If so, I don't really care about that. i
> >>> just want the graphic.
> >>>
> >>> Yes but the point is that, if I understand the processes involved
> >>> correctly, the export and babel routes each generate different latex
> >>> code.  Babel does *not* look at the document wide settings whereas
> >>> export does.  This is why Eric is suggesting you export the babel code
> >>> so that it is interpreted by the latex document that results from
> >>> exporting the whole org document.  Otherwise, make sure the settings
> >>> you want are within the latex source code block?
> >>>
> >>
> >> That makes more sense, though if I export the code into the larger LaTeX
> >> document, I'm left where I started, I believe. An 8.5x11 exported PDF
> with
> >> my diagram in the middle of it.
> >>
> >> If it's just getting the right code into the babel block, that's helpful
> to
> >> know. Perhaps the easiest way to put it is this: what is the best path
> to
> >> obtain the following:
> >>
> >> - a single pdf output of my TikZ diagram, cropped to fit the diagram
> >> - the font used in the TikZ diagram that I desire (preferably from the
> doc)
> >>
> >> Again, my use-case is one in which I have daily notes or a paper with a
> >> diagram but also would like to preserve the diagram for reuse. With
> babel,
> >> it appears this should be possible -- I can both export normally and
> have
> >> the graphic in the paper or send the TikZ section alone to export and
> use
> >> the graphic in a presentation or elsewhere.
> >>
> >> I wondered about what you said re. putting the settings in the latex
> source
> >> code block, and I was actually fiddling around with that yesterday. My
> font
> >> is simply set like so (present in the examples I posted earlier):
> >>
> >> #+latex_header: \usepackage{lmodern}
> >> #+latex_header: \renewcommand{\rmdefault}{cmss}
> >>
> >> But I tried putting variations of this in the babel block (without the
> >> #+latex_header part, of course) with no success.
> >>
> >> These didn't work for me:
> >>
> >> #+begin_src latex :file flow-chart.pdf :packages '(("" "tikz")) :border
> 1em
> >> \usepackage{lmodern}
> >> \renewcommand{\rmdefault}{cmss}
> >>
> >> or
> >>
> >> #+begin_src latex :file flow-chart.pdf :packages '(("" "tikz"
> "lmodern"))
> >> :border 1em
> >> \renewcommand{\rmdefault}{cmss}
> >>
> >> or
> >>
> >> #+begin_src latex :file flow-chart.pdf :packages '(("" "tikz lmodern"))
> >> :border 1em
> >> \renewcommand{\rmdefault}{cmss}
> >>
> >> I haven't found anything at ob-doc-latex covering how to pass package
> >> arguments or include LaTeX settings directly in the babel block. My
> attempts
> >> at the renewcommand end up with "cmss" ending up in my TIkZ graphic
> >> somewhere...
> >>
> >>
> >> Thanks for persisting with me!
> >> John
> >>
> >>
> >>
> >>
> >>
> >>> --
> >>> Eric S Fraga
> >>> GnuPG: 8F5C 279D 3907 E14A 5C29  570D C891 93D8 FFFC F67D
> >>>
> >>>
> >>
>

[-- Attachment #1.2: Type: text/html, Size: 8091 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: TikZ to separate file (babel?) possible?
  2010-10-28 21:43                       ` John Hendy
@ 2010-10-28 21:52                         ` John Hendy
  0 siblings, 0 replies; 15+ messages in thread
From: John Hendy @ 2010-10-28 21:52 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 677 bytes --]

Eric,


Just retried and was able to get it to work. Perhaps someone should add this
to the ob-doc-latex page? For reference, I tried each of the following:

Works: 1) #+begin_src latex :headers \renewcommand{\rmdefault}{cmss}

Doesn't work: 2) #+begin_src latex :headers
'("\\renewcommand{\rmdefault}{cmss}")

Works: 3) #+begin_src latex :headers '("\\usepackage{mathpazo}")

Which was puzzling me about #2 which led me to try:

Works: 4) Doesn't work: 2) #+begin_src latex :headers
'("\\renewcommand{\\rmdefault}{cmss}")

Note the second double backslash before rmdefault. That escape character was
necessary there, too.

Thanks for the help on this!! It's *perfect*.


John

[-- Attachment #1.2: Type: text/html, Size: 1067 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

end of thread, other threads:[~2010-10-28 21:52 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-22 20:13 TikZ to separate file (babel?) possible? John Hendy
2010-10-22 20:35 ` Erik Iverson
2010-10-22 21:25 ` Eric Schulte
2010-10-22 21:36   ` John Hendy
2010-10-22 23:11     ` Eric S Fraga
2010-10-23 17:58       ` John Hendy
2010-10-25 18:21         ` John Hendy
2010-10-25 18:53           ` Eric Schulte
2010-10-25 18:58             ` John Hendy
2010-10-26  8:17               ` Eric S Fraga
2010-10-26 14:34                 ` John Hendy
2010-10-26 21:34                   ` John Hendy
2010-10-26 23:01                     ` Eric Schulte
2010-10-28 21:43                       ` John Hendy
2010-10-28 21:52                         ` John Hendy

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