0

I'm using latex to format my Anki cards and ran into an error:

"! LaTeX Error: Cannot determine size of graphic in"

\begin{center}
\includegraphics{supplementary.PNG}\\\relax {{c1::Supplementary angle}}
\end{center}

I'm using TexLive if this helps.

  • 1
    Welcome to TeX.SX! The latex executable (i.e. pdfLaTeX with DVI output) doesn't work with .png images. Try changing the executable to pdflatex – Phelype Oleinik Nov 03 '19 at 19:18
  • How can i do that? – Vocaloidas Nov 03 '19 at 19:22
  • How are you compiling your document? From the command line or using an editor? If you're using an editor, which one? – Phelype Oleinik Nov 03 '19 at 19:31
  • Well, In Anki we have a preview option which allows us to view the card. It works well when I use it without any images, but as soon as I attempt to implement images, it breaks. It could be that the preview function uses some default setting of LaTeX to execute the code, in which case I'm not really sure how to change it. – Vocaloidas Nov 03 '19 at 19:35
  • 1
    Oh, Anki is the program. I don't have it, so I can't tell you exactly what to do, sorry. Try looking for some setting to change the TeX engine/compiler and make sure it is set to pdflatex instead of just latex. Ah, it seems that latex is hard-coded in the program (see here). Try changing that to pdflatex in the source of the program. – Phelype Oleinik Nov 03 '19 at 19:42
  • If you do as Phelype Oleinik suggests, make sure to also change dvipng to a PDF based workflow. – TeXnician Nov 03 '19 at 22:17
  • Hi, I downloaded an addon for anki called "Edit Latex Build Process" which allows me to change the configuration dictionary as @Phelype Oleinik suggested. I changed under the "pngCommands": the "latex" line to "pdflatex" and as @TeXnician suggested, I changed the "dvipng" to "dvipdfmx" which based on my research what TexLive supports.

    However, a new problem occurs. The error begins with: This is pdfTeX, Version 3.14159265-2.6-1.40.20 which seems like a good sign and this seems to be the interesting part Overfull \hbox (1005.7175pt too wide) detected at line 27.

    – Vocaloidas Nov 04 '19 at 10:19
  • @Vocaloidas That's not an error, it's TeX warning you (see here) that whatever you tried to include in your document is 1005 pt too large to fit there (which is a pretty large amount, so it should be visible from the output). If it's the picture, you need to resize it somehow (Sorry, I have no idea how this Anki thingy works). – Phelype Oleinik Nov 04 '19 at 12:49

0 Answers0