0

I have a problem with LaTeX. I am using TeXstudio, MikTeX and the article class, but suddenly my figures have started raising errors. It happened a day after MiKTeX updates. My code for figures is

    \begin{figure}
    \centering
    \includegraphics[scale=0.45]{Figure1.pdf}
    \caption{\footnotesize Caption }
    \label{fig:fig38}
    \end{figure}

I get the errors

    Missing endcsname inserted. \includegraphics[scale=0.45]{Figure1}
    Use of ??? doesn't match its definition. \includegraphics[scale=0.45]{Figure1}
    Missing endcsname inserted. \includegraphics[scale=0.45]{Figure1}
    Use of ??? doesn't match its definition. \includegraphics[scale=0.45]{Figure1}
    File `Figure1' not found. \includegraphics[scale=0.45]{Figure1}

No other errors then those concerning the figures are shown in the log window.

What is wrong? I have recreated the problem in a newly created article file [CODE]:

    \documentclass[a4paper,12pt]{article}

    \usepackage[utf8]{inputenc}

    \usepackage{underscore}

    \usepackage{graphicx}

    \usepackage{amsmath}

    \usepackage{csquotes}

    \usepackage[style=authoryear,maxcitenames=2,maxbibnames=99,uniquelist=false,backend=biber]{biblatex}

    \usepackage{titlesec}

    \usepackage{algorithmicx}

    \usepackage{algorithm}


    \usepackage{algpseudocode}

    \renewcommand\algorithmicthen{}

    \usepackage{amsfonts}

    \usepackage{lipsum}

    \usepackage[export]{adjustbox}

    \usepackage{hyperref}

    \graphicspath{{C:\\Users\\user\\Documents\\Folder\\Subfolder}}

    \titlelabel{\thetitle.\quad}

    \addbibresource{}% Syntax for version >= 1.2

    \renewcommand\algorithmicthen{}% Remove 'then' text

    \algtext*{EndIf}% Remove 'end if' text

    \renewcommand\algorithmicdo{}

    \algtext*{EndFor}% Remove 'end if' text

    \usepackage{multirow}

    \usepackage[figurename=Fig.,labelsep=endash,labelfont=bf]{caption}

    \usepackage{longtable}

    \usepackage{adjustbox}

    \usepackage{caption}

    \usepackage{amsthm}

    \newtheorem{theorem}{Theorem}

    \newtheorem{definition}{Definition}[section]

    \theoremstyle{definition}

    \usepackage{appendix}

    \providecommand{\keywords}[1]
    {
        \small  
        \textbf{\textit{Keywords:}} #1
    }


    \usepackage{authblk}



    \title{Title}

    \author{Author}

    \affil{\footnotesize{something}}

    \date{\footnotesize \today}

    \begin{document}
        \maketitle
        \begin{abstract}
    
            \footnotesize \lipsum
    
        \end{abstract}




        \begin{figure}[htp]
    
            \includegraphics[scale=0.45]{Figure1}
            \caption{\footnotesize Caption }
            \centering
            \label{fig:fig38}
        \end{figure}




    \end{document}

What am I doing wrong? Should I reinstall MikTeX, given that it happened only after packages' and MikTeX updates? It is probably not a packages clash, because after deleting all the parts of preamble concerning algorithms, the problem persists. It persists even after deleting the import of all other packages, except for the necessary ones and graphicx.

8
  • \graphicspath{{C:\\Users\\user\\Documents\\Folder\\Subfolder}} is wrong \\ never separates directories in tex. If you must use graphicspath,, use / even on windows. Commented Nov 4, 2023 at 18:53
  • unrelated but \keywords{something,foo,bar} would make the whole document \small, did you intend to have a group there? Commented Nov 4, 2023 at 19:01
  • Firstly, prof. Carlisle your answer is correct - I have been using an old version of TeXstudio were only this worked (directory with '\\'), but suddenly it stopped. In the new version, after retyping, it works. Sorry, please tell me how to accept your answer - there is no check mark to click on! Secondly - actually, the keywords{} command is correct. It provides keywords under the abstract; the rest of the text is unaffected by it. I have used it many times.
    – Lchwpl
    Commented Nov 4, 2023 at 19:09
  • 1
    No. \\ in graphicspath has never worked in latex. (I wrote that code:-) Commented Nov 4, 2023 at 19:13
  • Well, it worked on my computer! This is not my first LaTeX article.
    – Lchwpl
    Commented Nov 8, 2023 at 12:45

1 Answer 1

1
\graphicspath{{C:\\Users\\user\\Documents\\Folder\\Subfolder}}

is wrong \\ never separates directories in tex. If you must use graphicspath, use / even on windows. (This has never worked, this is not a change, or related to texstudio, which is just the editor)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .