1

First of all my latex knowledge is very basic. I would like to create a report using multiple images. All images have the date of creation as part of its name. I was wondering whether I could use a macro to specify the date so I can display only the relevant images This is my code

\documentclass[11pt]{article}

\usepackage{graphicx}

\def\a{04mar2015}

\begin{document}

\includegraphics[width=3in]{week 1/DENY claims $\a$.png}

\end{document}

As you can see the name of the file should be "DENY claims 04mar2015". When i run this code I get the following error ! Package pdftex.def Error: File `week 1/DENY claims $04mar2015$.png' not found.

Is it possible to use macros accomplish this task or should I use another method.

David Carlisle
  • 757,742
Rodrigo
  • 11
  • 1

1 Answers1

2

A couple of things:

  1. Using spaces in filename is not really recommended. There are ways around it though, as described in How to include graphics with spaces in their path?

  2. You can use macro names in filenames, since they will expand to their true meaning (as far as can be expanded). However, there's no need for writing an expandable macro in math mode, so use \a, not $\a$.

  3. It is sometimes more convenient to drop the file extension when including graphics. See Graphics file extensions and their order of inclusion when not specified.

Werner
  • 603,163