Graphics, Figures & Tablessubfig-package

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
judith1703
Posts: 3
Joined: Thu Aug 17, 2017 3:29 pm

subfig-package

Post by judith1703 »

Hello everyone,

I am working on my Bachelor Thesis using LaTeX. I'm trying to put several pictures in the same figure using the subfig-package. I am using the following code to do so:

Code: Select all

\begin{figure}[bth]
\centering
\subfloat[Versuch 1.1]{\includegraphics[height=6cm]{./bilder/Versuch1_1}}
\subfloat[Versuch 1.2]{\includegraphics[height=6cm]{./bilder/Versuch1_2}}
\subfloat[Versuch 1.3]{\includegraphics[height=6cm]{./bilder/Versuch1_3}}
\subfloat[Versuch 1.4]{\includegraphics[heigth=6cm]{./bilder/Versuch1_4}}
\caption{\textbf{Aufnahmen der Versuchsreihe 1.} Die Abbildung zeigt die Aufnahmen der Versuche~1.1 bis 1.4. Die Anordnung der LED-Spots relativ zur Kamera ist wie folgt: (a) Gegenlicht mit einem LED-Spot; (b) Frontlicht mit einem LED-Spot; (c) Seitenlicht mit zwei LED-Spots; (d) Frontlicht mit zwei LED-Spots.}
\label{fig:sdqlogo}
\end{figure}
I included the subfig-package in the preamble. My problem now is that LaTeX tells me the PDFLaTeX-process is exited with errors but does NOT show any error messages in the Log-file. I tried to deleting all of the .aux,... files and it still doesn't work.

Maybe someone can help me. I would really appreciate it!

Thanks in advance.

Judith
Last edited by Stefan Kottwitz on Tue Aug 22, 2017 7:08 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

thomasb
Posts: 134
Joined: Thu Aug 03, 2017 10:54 am

subfig-package

Post by thomasb »

Achtung, kartoffeln (http://mirrors.ircam.fr/pub/CTAN/macros ... subfig.pdf, p. 42-43) :

Code: Select all

\documentclass{book}
\usepackage{subfig}
\begin{document}
\begin{figure}%
\centering
\subfloat[First.]{...}\qquad
\subfloat[Second figure.]{...}\\
\subfloat[Third.]{\label{3figs-c}...}%
\caption{Three sub-floats.}
\label{3figs}
\end{figure}
.
.
.
Figure~\ref{3figs} contains two top ‘sub-floats’ and
sub-float~\ref{3figs-c}.
\end{document}
height, spell ght, not gth, rigolote...
judith1703
Posts: 3
Joined: Thu Aug 17, 2017 3:29 pm

subfig-package

Post by judith1703 »

Thanks for your answer. That was a really bad spelling and copy-paste error! I am still getting the same result though after I made the changes. Even if I use width to set the size of the picture. LaTex still tells me there are errors but the log-file shows no errors.
thomasb
Posts: 134
Joined: Thu Aug 03, 2017 10:54 am

subfig-package

Post by thomasb »

judith1703 wrote:LaTex still tells me there are errors but the log-file shows no errors.
Copy-paste the error message, then...
User avatar
Stefan Kottwitz
Site Admin
Posts: 10320
Joined: Mon Mar 10, 2008 9:44 pm

subfig-package

Post by Stefan Kottwitz »

Hi Judith,

welcome to the forum!

After fixing "height", the code should run without errors. It does when I test it. You can test yourself, just copy&paste and try or click on "Open in Overleaf":

Code: Select all

\documentclass{book}
\usepackage{subfig}
\usepackage[demo]{graphicx}
\begin{document}
\begin{figure}[bth]
\centering
\subfloat[Versuch 1.1]{\includegraphics[height=6cm]{./bilder/Versuch1_1}}
\subfloat[Versuch 1.2]{\includegraphics[height=6cm]{./bilder/Versuch1_2}}
\subfloat[Versuch 1.3]{\includegraphics[height=6cm]{./bilder/Versuch1_3}}
\subfloat[Versuch 1.4]{\includegraphics[height=6cm]{./bilder/Versuch1_4}}
\caption{\textbf{Aufnahmen der Versuchsreihe 1.} Die Abbildung zeigt die Aufnahmen der Versuche~1.1 bis 1.4. Die Anordnung der LED-Spots relativ zur Kamera ist wie folgt: (a) Gegenlicht mit einem LED-Spot; (b) Frontlicht mit einem LED-Spot; (c) Seitenlicht mit zwei LED-Spots; (d) Frontlicht mit zwei LED-Spots.}
\label{fig:sdqlogo}
\end{figure}
\end{document}
So, make sure that the .log file is actually the current one made by LaTeX. If LaTeX exits with errors, the errors are in the .log file. You can post the log file here, as attachment to a post. The "Attachments" link is below the text edit field, when writing a post.

Stefan
LaTeX.org admin
judith1703
Posts: 3
Joined: Thu Aug 17, 2017 3:29 pm

subfig-package

Post by judith1703 »

When I use the demo-version of the graphicx-package it works just fine. But I get the same error as before as soon as I use the graphicx-package.
Attachments
Fotos.log
(6.39 KiB) Downloaded 420 times
thomasb
Posts: 134
Joined: Thu Aug 03, 2017 10:54 am

subfig-package

Post by thomasb »

The image is corrupted, try another one from the internet.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10320
Joined: Mon Mar 10, 2008 9:44 pm

subfig-package

Post by Stefan Kottwitz »

Actually there is an error message. The last thing in the .log file:

!pdfTeX error: pdflatex (file ./bilder/Versuch1_1.jpg): reading JPEG image failed
(no JPEG header found)
==> Fatal error occurred, no output PDF file produced!


Check if Versuch1_1.jpg is indeed a jpg file, or if it's a bmp or png file just saved with the wrong file name extension jpg. Open it with a graphic editor, save it as jpg again (lossless compression) or as png.

Either the image is broken, as Thomas said, or it's just in another format. For example, somebody could "convert" an unsupported format into a supported format by changing the file name extension to jpg, but that would be wrong. A conversion needs graphics software such as the free GIMP or ImageMagick or Paint.net, to name a few examples.

Stefan
LaTeX.org admin
Post Reply