emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* naming image files before exporting to PDF
@ 2015-02-05 23:42 Timothée Flutre
  2015-02-06  0:18 ` John Kitchin
  0 siblings, 1 reply; 5+ messages in thread
From: Timothée Flutre @ 2015-02-05 23:42 UTC (permalink / raw)
  To: emacs-orgmode

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

Hello,

I am using Emacs 24.3.1 + Org-mode 8.2.10 for my work and would like to
include images (typically output files in PDF from R) in my org files. Such
image files correspond to graphics describing computer simulations. Thus, I
would like to name them as meaningfully as possible, for instance
simul001_a-4_b-0.1.pdf, which would indicate that parameter a was fixed at
4 and parameter b at 0.1 for the first simulation.

In the org file, it would look like this:
#+latex_header: \graphicspath{ {./images/} }
[[file:simul001_a-4_b-0.1.pdf]]

After doing C-c C-e l l, the tex file would look like that:
...
\includegraphics[width=.9\linewidth]{simul001_a-4_b-0.1.pdf}
...

However, after C-c C-e l p, it doesn't work. Instead of the image, the pdf
contains the following sentence, _a-4_b-0.1.pdf _a-4_b-0.1.pdf.

I tested with "simul001.pdf", and it works smoothly.

I tested with "simul001_a_4_b_0_1.pdf", and it doesn't work. Instead of the
image, the pdf contains the following sentence, _a_4_b_0_1.pdf
_a_4_b_0_1.pdf, followed by an empty box containg somethign like
simul001\unhbox \voidb@x \penalty \@M \hskip \z@skip.

I know that LaTeX doesn't like special characters in file names to include.
However, I thought that underscores and hyphens were ok. As I guess I'm not
the only one who wants to name his files meaningfully, I wonder how other
people do. Would anyone have any idea?

TF

[-- Attachment #2: Type: text/html, Size: 1724 bytes --]

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

* Re: naming image files before exporting to PDF
  2015-02-05 23:42 naming image files before exporting to PDF Timothée Flutre
@ 2015-02-06  0:18 ` John Kitchin
  2015-02-06  8:06   ` Rainer M Krug
  0 siblings, 1 reply; 5+ messages in thread
From: John Kitchin @ 2015-02-06  0:18 UTC (permalink / raw)
  To: timflutre; +Cc: emacs-orgmode@gnu.org

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

Dashes are usually fine. Did you try replacing the _ with -?

I try to avoid _ in filenames, but - works for me.

On Thu, Feb 5, 2015 at 6:42 PM, Timothée Flutre <timflutre@gmail.com> wrote:

> In the org file, it would look like this:
> #+latex_header: \graphicspath{ {./images/} }
> [[file:simul001_a-4_b-0.1.pdf]]




John

-----------------------------------
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

[-- Attachment #2: Type: text/html, Size: 1187 bytes --]

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

* Re: naming image files before exporting to PDF
  2015-02-06  0:18 ` John Kitchin
@ 2015-02-06  8:06   ` Rainer M Krug
  2015-02-06  9:15     ` Timothée Flutre
  2015-02-06  9:21     ` Andreas Leha
  0 siblings, 2 replies; 5+ messages in thread
From: Rainer M Krug @ 2015-02-06  8:06 UTC (permalink / raw)
  To: John Kitchin; +Cc: emacs-orgmode@gnu.org, timflutre

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

I remember a similar problem, and the cuprit was the dot. If I remember
correctly, LaTeX was interpreting everything after the *first* "." as
the extension.

After avoiding "." in file names for images, it worked.

"_" are fine.

Rainer


John Kitchin <jkitchin@andrew.cmu.edu> writes:

> Dashes are usually fine. Did you try replacing the _ with -?
>
> I try to avoid _ in filenames, but - works for me.
>
> On Thu, Feb 5, 2015 at 6:42 PM, Timothée Flutre <timflutre@gmail.com> wrote:
>
>> In the org file, it would look like this:
>> #+latex_header: \graphicspath{ {./images/} }
>> [[file:simul001_a-4_b-0.1.pdf]]
>
>
>
>
> John
>
> -----------------------------------
> Professor John Kitchin
> Doherty Hall A207F
> Department of Chemical Engineering
> Carnegie Mellon University
> Pittsburgh, PA 15213
> 412-268-7803
> @johnkitchin
> http://kitchingroup.cheme.cmu.edu

-- 
Rainer M. Krug
email: Rainer<at>krugs<dot>de
PGP: 0x0F52F982

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 494 bytes --]

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

* Re: naming image files before exporting to PDF
  2015-02-06  8:06   ` Rainer M Krug
@ 2015-02-06  9:15     ` Timothée Flutre
  2015-02-06  9:21     ` Andreas Leha
  1 sibling, 0 replies; 5+ messages in thread
From: Timothée Flutre @ 2015-02-06  9:15 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: emacs-orgmode@gnu.org, John Kitchin

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

Thanks for your answers. In fact, the problem comes from the LaTeX package
"underscore" (I had it in my ~/.emacs).

In this situation:

#+latex_header: \usepackage{underscore}
#+latex_header: \graphicspath{ {./images/} }
[[file:simul001_a-4_b-0-1.pdf]]
=> the image is not displayed

Whereas in this situation:
#+latex_header: \graphicspath{ {./images/} }
[[file:simul001_a-4_b-0-1.pdf]]
=> the image is displayed correctly

Therefore, if one needs to have any underscore in the text as well as in
image file names, the only way I found is to use the verbatim mode ("=" in
org-mode) to handle underscore in text.
Here is an example that works:

#+latex_header: \graphicspath{ {./images/} }
File name: =simul001_a-4_b-0-1.pdf=
[[file:simul001_a-4_b-0-1.pdf]]

Note also that underscore "_" and hyphen "-" work well separately as well
as together.

Timothée Flutre

2015-02-06 9:06 GMT+01:00 Rainer M Krug <Rainer@krugs.de>:

> I remember a similar problem, and the cuprit was the dot. If I remember
> correctly, LaTeX was interpreting everything after the *first* "." as
> the extension.
>
> After avoiding "." in file names for images, it worked.
>
> "_" are fine.
>
> Rainer
>
>
> John Kitchin <jkitchin@andrew.cmu.edu> writes:
>
> > Dashes are usually fine. Did you try replacing the _ with -?
> >
> > I try to avoid _ in filenames, but - works for me.
> >
> > On Thu, Feb 5, 2015 at 6:42 PM, Timothée Flutre <timflutre@gmail.com>
> wrote:
> >
> >> In the org file, it would look like this:
> >> #+latex_header: \graphicspath{ {./images/} }
> >> [[file:simul001_a-4_b-0.1.pdf]]
> >
> >
> >
> >
> > John
> >
> > -----------------------------------
> > Professor John Kitchin
> > Doherty Hall A207F
> > Department of Chemical Engineering
> > Carnegie Mellon University
> > Pittsburgh, PA 15213
> > 412-268-7803
> > @johnkitchin
> > http://kitchingroup.cheme.cmu.edu
>
> --
> Rainer M. Krug
> email: Rainer<at>krugs<dot>de
> PGP: 0x0F52F982
>

[-- Attachment #2: Type: text/html, Size: 2989 bytes --]

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

* Re: naming image files before exporting to PDF
  2015-02-06  8:06   ` Rainer M Krug
  2015-02-06  9:15     ` Timothée Flutre
@ 2015-02-06  9:21     ` Andreas Leha
  1 sibling, 0 replies; 5+ messages in thread
From: Andreas Leha @ 2015-02-06  9:21 UTC (permalink / raw)
  To: emacs-orgmode

Hi,

usually, the grffile package works very well.

Try this, which works fine for me:

--8<---------------cut here---------------start------------->8---
#+latex_header: \graphicspath{ {./images/} }
#+latex_header: \usepackage{grffile}

* test
In the org file, it would look like this:

[[file:simul001_a-4_b-0.1.pdf]]
--8<---------------cut here---------------end--------------->8---

Best,
Andreas




Rainer M Krug <Rainer@krugs.de> writes:
> I remember a similar problem, and the cuprit was the dot. If I remember
> correctly, LaTeX was interpreting everything after the *first* "." as
> the extension.
>
> After avoiding "." in file names for images, it worked.
>
> "_" are fine.
>
> Rainer
>
>
> John Kitchin <jkitchin@andrew.cmu.edu> writes:
>
>> Dashes are usually fine. Did you try replacing the _ with -?
>>
>> I try to avoid _ in filenames, but - works for me.
>>
>> On Thu, Feb 5, 2015 at 6:42 PM, Timothée Flutre <timflutre@gmail.com> wrote:
>>
>>> In the org file, it would look like this:
>>> #+latex_header: \graphicspath{ {./images/} }
>>> [[file:simul001_a-4_b-0.1.pdf]]
>>
>>
>>
>>
>> John
>>
>> -----------------------------------
>> Professor John Kitchin
>> Doherty Hall A207F
>> Department of Chemical Engineering
>> Carnegie Mellon University
>> Pittsburgh, PA 15213
>> 412-268-7803
>> @johnkitchin
>> http://kitchingroup.cheme.cmu.edu

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

end of thread, other threads:[~2015-02-06  9:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-05 23:42 naming image files before exporting to PDF Timothée Flutre
2015-02-06  0:18 ` John Kitchin
2015-02-06  8:06   ` Rainer M Krug
2015-02-06  9:15     ` Timothée Flutre
2015-02-06  9:21     ` Andreas Leha

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