Graphics, Figures & TablesIndention and figures

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
thorpn
Posts: 53
Joined: Mon Jul 30, 2012 7:30 pm

Indention and figures

Post by thorpn »

Is there a way to NOT have LaTex indent ones figures ? fx. in my latex:

Code: Select all

\begin{figure}
        %\centering
        \begin{subfigure}[b]{0.3\textwidth}

	\includegraphics[width=9cm]{billeder/HiddenRisk.eps}
		\caption{Tail stuffing.}
		\label{part1.chapterRiskMeasures.hiddenrisk}
        \end{subfigure}%
        \qquad \qquad \qquad \qquad  \qquad%This adds space between images
        \begin{subfigure}[b]{0.3\textwidth}

	\includegraphics[width=9cm]{billeder/spectral.eps}
		\caption{Weight functions}
		\label{fig:spectral}
        \end{subfigure}
        \caption{ }\label{fig:animals}
\end{figure}
I would want to avoid the figure being pushed in longer than the normal text, to me it just makes the figure seem off centered.

Thank you

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Indention and figures

Post by Johannes_B »

Can you please provide a proper minimal working example? Right now, i can't tell, that your figure are offset.

Those examples are helping us to understand your problem, with "code" it's just easier to understand and more explicit.

Putting something 9 cm in width in a box of 30 % of the textwidth, ...
that means, that your text is at least 27 cm wide. A4 is not. Think about it.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
thorpn
Posts: 53
Joined: Mon Jul 30, 2012 7:30 pm

Re: Indention and figures

Post by thorpn »

Thanks for the reply, i fixed the width thing (i have just been copy pasting it). I have included a minimum working example, though it is less than very minimum i suppose as it uses quite a few packages. The main tex file is the one caled minitex

Thank you :)
Attachments
Ny mappe.rar
(87.09 KiB) Downloaded 311 times
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Indention and figures

Post by Johannes_B »

Preparing a minimal example isn't a hard thing to do.

Consider the following mathematical journey: You are setting the left margin to 2.5 cm, the right one to 3cm. The widths of your subfigures are 9 cm.

Code: Select all

2.5 + 3 + 9 + 9 = 23.5
You're trying to put an oversized load (235 mm) on an A4-page (210 mm). This can't be good, right?

So, take a look at my example. All widths are specified as fractions of the textwidth/linewidth.

Code: Select all

\documentclass[10pt,a4paper,oneside]{paper}
\usepackage[top=2.5cm,left=2 cm,right=3.0 cm,bottom=2.5cm,headheight=12.0 pt]{geometry}	
\usepackage{graphicx}
\usepackage{subcaption}

\begin{document}
\begin{figure}
  \centering
  \begin{subfigure}[b]{0.45\linewidth}
    \includegraphics[width=\linewidth]{example-image-a}
    \caption{Tail stuffing.}
    \label{part1.chapterRiskMeasures.hiddenrisk}
  \end{subfigure}%
  \hfil
  \begin{subfigure}[b]{0.45\linewidth}
    \includegraphics[width=\linewidth]{example-image-b}
    \caption{Weight functions}
    \label{fig:spectral}
  \end{subfigure}
  \caption{ }\label{fig:animals}
\end{figure}
\end{document}
By the way, that was by far not a proper example. If you would have done one, you would have noticed that something suspiciously strange.
Downloading and taking a look at your files was just my kindness right now.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
thorpn
Posts: 53
Joined: Mon Jul 30, 2012 7:30 pm

Re: Indention and figures

Post by thorpn »

Well thanks for the lindewidth thing i guess, it didnt really solve my problem but it is a nifty thing which ill definantly use. The odd thing is that the example images work fine (edges are same as for the text), but not for the images i use. I even tried redoing the images to make sure they are square, didnt work.

Anyway, i would rather accept the slightly less than perfect looking images than deal with you. I truly understand that you are trying to help and i appreciate that, i just disslike the tone of it.

Thank you anyway
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Indention and figures

Post by Johannes_B »

I'm sorry to hear that. Turns out I slightly misread your problem. A simple \noindent after \begin{figure} should do the trick. But since there is some whitespace on the left side of the figures, it will always look a bit off.

Again, sorry. But please think about my remarks anyway.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
Post Reply