2

I am trying to include a png with a tablature in a song in my chord book which uses the leadsheets package. However, the file fails to compile once I add \includegraphics inside the song environment. Outside it works fine, therefore the image actually exists and can be found by LaTeX. Is there some way to get around this and include an image in a song? I have also tried putting the image inside environments like verse or intro nested inside a song environment.

Minimum working example (needs an image file in the folder ./Images/my_image.png):

\documentclass[a4paper, 8pt]{book}

\usepackage{leadsheets} %songbook functionality, chords ...
\usepackage{graphicx}

\begin{document}
    % if you uncomment this and comment out the other lines, it works -> The image is actually in the specified path
    % \includegraphics{./Images/my_image} 

    \begin{song}{title={My song}}
        \includegraphics{./Images/my_image} 
    \end{song}
\end{document}

The error log contains these lines, which should be the relevant ones:

("C:\Users\Taxel\AppData\Local\Programs\MiKTeX 2.9\tex\generic\oberdiek\etexcmd
s.sty"
Package: etexcmds 2016/05/16 v1.6 Avoid name clashes with e-TeX commands (HO)
Package etexcmds Info: Could not find \expanded.
(etexcmds)             That can mean that you are not using pdfTeX 1.50 or
(etexcmds)             that some package has redefined \expanded.
(etexcmds)             In the latter case, load this package earlier.
)))
Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 4
38.
Package grfext Info: Graphics extension search list:
(grfext)             [.pdf,.png,.jpg,.mps,.jpeg,.jbig2,.jb2,.PDF,.PNG,.JPG,.JPE
G,.JBIG2,.JB2,.eps]
(grfext)             \AppendGraphicsExtensions on input line 456.
)

! LaTeX Error: File `./Images/my_image' not found.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.12     \end{song}
  • Try to rename your image without special characters such as _ – user36296 Aug 19 '18 at 20:24
  • If I replace my_image with my-image it works fine for me. – user36296 Aug 19 '18 at 20:25
  • Thanks, that was it! Could you please post this as an answer, so I can mark this as answered and resolved? – Taxel Aug 20 '18 at 20:43
  • Done :) ............ – user36296 Aug 20 '18 at 20:53
1

File names with special characters, such as _ can be tricky in some cases. Best stay on the safe side and avoid them.

If I rename my_image to my-image your example works fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.