Graphics, Figures & TablesWeird lines around figures

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
Smartmouse
Posts: 2
Joined: Thu Feb 24, 2022 5:49 pm

Weird lines around figures

Post by Smartmouse »

When putting figures in my text, I always get weird, short, horizontal lines around the picture (see attached). I'm new to Latex, so I'm using very basic scripts to put figures in:

\begin{figure}[!ht] |\\
\centering|\\
\includegraphics[width=\textwidth]{fig/Knipsel2.PNG}|\\
\caption{Velocity components through the vehicle \cite{zhao-2006}}|\\
\label{fig:Velocity components through the vehicle}|\\
\end{figure}|

This is the script to the attached image.
Does anyone know how to fix it? Thanks!
Attachments
horizontal lines.PNG
horizontal lines.PNG (53.65 KiB) Viewed 3462 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Ijon Tichy
Posts: 640
Joined: Mon Dec 24, 2018 10:12 am

Weird lines around figures

Post by Ijon Tichy »

Without a correct as code marked Infominimal working example I can only suggest to remove all the |\\ from your code.
Sorry, but I can no longer participate here as the administrator is trampling on my wishes on one of his other platforms. :cry:
Smartmouse
Posts: 2
Joined: Thu Feb 24, 2022 5:49 pm

Weird lines around figures

Post by Smartmouse »

Ijon Tichy wrote:Without a correct as code marked Infominimal working example I can only suggest to remove all the |\\ from your code.
Aah yes indeed, I saw my mistake. I copied what uni gave as an example, (\verb| \begin{figure}[!ht] |\\) And I only deleted the \verb| part. So indeed, with the |\\ gone, it is fixed. Thanks a lot!
Post Reply