0

UPDATE: I've just updated the code to put a full example of the code generating the error messages.

UPDATE2: I tried to change the name of figure files (without underscores) but I still have the issue.

In short, I am experiencing two issues when trying to include a figure using the following code:

\documentclass[11pt]{book}

\usepackage{algorithm}
\usepackage{float}
\usepackage{overpic}

\title{\bf An Example of Book Class}
\author{for \LaTeX\ Class}
\date{\today}

\begin{document}
\maketitle
\mainmatter
\part{A Part Heading}
\chapter{A Main Heading}

\begin{figure}[!H]
    % trim={<left> <lower> <right> <upper>}
    \begin{overpic}{
        \includegraphics[width=1\textwidth, trim=95 20 95 30]{figures/file1.eps}}
        \put(-500,220){\includegraphics[scale=0.72, trim=35 10 35 12]{figures/file2.eps}}
    \end{overpic}
    \caption{hi.}
    \label{fig:displacement-errors}
\end{figure}

\end{document}

Error messages i am getting are:

[Error(s)]
E: exbook.tex:17    LaTeX Error: Unknown float option `H'.
E: exbook.tex:26    Undefined control sequence \filename@base.
  • Welcome to TeX.SX! \detokenize is not supposed to be used in filenames, only when typesetting the underscores. Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. – Phelype Oleinik Feb 6 '18 at 20:26
  • you can never use ! and H together and H does not work (as far as I know) with sidewaysfigure – David Carlisle Feb 6 '18 at 20:27
  • @DavidCarlisle thanks you are right, it works when using the H without the "!" overriding parameter. – Yazan Feb 7 '18 at 10:40
  • Which compiler are you using? If pdfTeX, remove the .eps extensions. Underscores in filenames have never been a problem for me and your errors don't mention them. – cfr Feb 8 '18 at 2:01
  • @cfr I use Texlive2017 on windows. and I am using pdfLaTeX. I am trying without .eps extension and getting a very similar error message: ! Undefined control sequence. \filename@simple ...#2\\}\fi \edef \filename@base {#1} l.20 ...xtwidth, trim=95 20 95 30]{figures/file1}} ? If I use the pdfTeX compiler i get the following error message: ! Undefined control sequence. l.1 \documentclass [11pt]{book} – Yazan Feb 8 '18 at 14:49
0

I found the solution myself! There is an error using the overpic instructions, hereafter the right code:

\begin{figure}[H]
    \begin{overpic}[width=1\textwidth, trim=95 20 95 30]{figures/file1.eps}
    \put(-500,220){\includegraphics[scale=0.72, trim=35 10 35 12]{figures/file2.eps}}
    \end{overpic}
    \caption{hi.}
    \label{fig:displacement-errors}
\end{figure}

There is no includegraphics to include the first graphic. Thanks for all commenters that tried to help :)

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.