TransWikia.com

How to put 3 pictures in a horizontal row evenly spaced apart

TeX - LaTeX Asked on December 20, 2020

I have 3 pictures in a horizontal row but I want them to be evenly spaced out and at the moment, they seem squished together leaving room on the far right side. I’m new to LaTeX so please bear with me! I assume it’s something to do with {.3textwidth} but when I play around with this, it changes their sizes and puts them on new lines.

begin{figure}[ht]
begin{subfigure}{.3textwidth}
  centering
  % include first image
  includegraphics[angle=270, width=1linewidth]{Trisecting an angle 1}  
  caption{Put your sub-caption here}
  label{fig:sub-first}
end{subfigure}
begin{subfigure}{.3textwidth}
  centering
  % include second image
  includegraphics[angle=270, width=1linewidth]{Trisecting an angle 2}  
  caption{Put your sub-caption here}
  label{fig:sub-second}
end{subfigure}
begin{subfigure}{.3textwidth}
  centering
  % include third image
  includegraphics[angle=270, width=1linewidth]{Trisecting an angle 3}  
  caption{Put your sub-caption here}
  label{fig:sub-second}
end{subfigure}
caption{Put your caption here}
label{fig:fig}
end{figure}

One Answer

In figure below images are pushed away with ˙|hfill` command:

documentclass{article}
usepackage{graphicx}
usepackage{subcaption}
%---------------- show page layout. don't use in a real document!
usepackage{showframe}
renewcommandShowFrameLinethickness{0.15pt}
renewcommand*ShowFrameColor{color{red}}
%---------------------------------------------------------------%

begin{document}
    begin{figure}[ht] 
begin{subfigure}{.3textwidth} 
centering 
% include first image 
includegraphics[angle=270, width=1linewidth]{example-image-a}%{Trisecting an angle 1}   
caption{Put your sub-caption here} 
label{fig:sub-first} 
end{subfigure}hfill% <---
begin{subfigure}{.3textwidth} 
centering 
% include second image 
includegraphics[angle=270, width=1linewidth]{example-image-b}%{Trisecting an angle 2}   
caption{Put your sub-caption here} label{fig:sub-second} 
end{subfigure}hfill% <--- 
begin{subfigure}{.3textwidth} 
centering 
% include third image 
includegraphics[angle=270, width=1linewidth]{example-image-c}%{Trisecting an angle 3}   caption{Put your sub-caption here} label{fig:sub-second} 
end{subfigure} 
caption{Put your caption here} 
label{fig:fig} 
    end{figure}
end{document}

enter image description here

(red lines indicate text borders)

Correct answer by Zarko on December 20, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP