1

I'm trying to place three figure side by side, the problem is that I don't know how to reduce the horizontal space between the figures that I want to put equal to zero.

\begin{figure}[!ht]
\captionsetup[subfloat]{farskip=0pt,captionskip=0.5pt}
%\centering
\subfloat{
\includegraphics[width = 0.33\textwidth]{Analysis/Histogram/B0.pdf}}
\subfloat[][]{
\includegraphics[width = 0.33\textwidth]{Analysis/Histogram/B1.pdf}}
\subfloat[][]{
\includegraphics[width = 0.33\textwidth]{Analysis/Histogram/B2.pdf}}
\caption{Histogram of the Asymmetry for Detector B. The Asymmetries are corrected removing the data without polarization. The raw asymmetries are multiplied by $\frac{1}{P}$}
\label{fig:AsymmtriesB0B1B2}
\end{figure}

the output

enter image description here

the preamble of the file is

\documentclass[11pt,a4paper,twoside,notitlepage,openright]{report}
%\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{subfig}

\usepackage{hyperref}
\hypersetup{hidelinks}
\usepackage{frontespizio}
\usepackage[english]{babel}
\usepackage{outlines}
\usepackage[output-decimal-marker={.}]{siunitx}
\usepackage{physics}
\usepackage{xcolor}
\usepackage{slashed}
\usepackage{amssymb}

\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage[toc,page]{appendix}
\usepackage[compat=1.1.0]{tikz-feynman}
\usepackage{wrapfig}
\usepackage{graphicx, wrapfig}
%\usepackage[rightcaption]{sidecap}
\usepackage{sidecap}
\usepackage{comment}

\tikzfeynmanset{every blob = {minimum size = 3mm}}
\newcommand{\commento}[1]{}
\newcommand{\Lagr}{\mathcal{L}}
%{\bfseries #1 \medskip}
\newcommand{\transv}{transverse asymmetry }
\pagestyle{headings}
\sidecaptionvpos{figure}{t}
%\setlength\intextsep{2pt}
\setlength{\textfloatsep}{10pt plus 1.0pt minus 1.0pt}
\author{Adriano del Vincio}

7
  • 1
    Welcome to TeX.SE! Please show your result, we do not have your images ...
    – Mensch
    Commented Jun 28, 2023 at 17:11
  • you are adding spaces use % at ends of lines Commented Jun 28, 2023 at 17:14
  • I have to use % where? Commented Jun 28, 2023 at 17:26
  • 1
    Use \subfloat{% and subfloat[][]{%, or remove the linebreak between \subfloat{/\subfloat[][]{ and \includegraphics.
    – gernot
    Commented Jun 28, 2023 at 17:37
  • Ok, I did it, but nothig has changes Commented Jun 28, 2023 at 17:43

2 Answers 2

0

enter image description here

\documentclass{article}
\usepackage{subfig}
\usepackage{graphicx}
\begin{document}
\begin{figure}[!ht]
\captionsetup[subfloat]{farskip=0pt,captionskip=0.5pt}
\subfloat[][]{% <== remove extra space here
\includegraphics[width = 0.33\textwidth]{example-image-a.pdf}}
\subfloat[][]{% <== remove extra space here
\includegraphics[width = 0.33\textwidth]{example-image-b.pdf}}
\subfloat[][]{% <== remove extra space here
\includegraphics[width = 0.33\textwidth]{example-image-c.pdf}}
\caption{Histogram of the Asymmetry for Detector B. The Asymmetries are corrected removing the data without polarization. The raw asymmetries are multiplied by $\frac{1}{P}$}
\label{fig:AsymmtriesB0B1B2}
\end{figure}
\end{document}

It also works with the full preamble given in the original post: enter image description here

\documentclass[11pt,a4paper,twoside,notitlepage,openright]{report}
%\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{subfig}

\usepackage{hyperref}
\hypersetup{hidelinks}
\usepackage{frontespizio}
\usepackage[english]{babel}
\usepackage{outlines}
\usepackage[output-decimal-marker={.}]{siunitx}
\usepackage{physics}
\usepackage{xcolor}
\usepackage{slashed}
\usepackage{amssymb}

\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage[toc,page]{appendix}
\usepackage[compat=1.1.0]{tikz-feynman}
\usepackage{wrapfig}
\usepackage{graphicx, wrapfig}
%\usepackage[rightcaption]{sidecap}
\usepackage{sidecap}
\usepackage{comment}

\tikzfeynmanset{every blob = {minimum size = 3mm}}
\newcommand{\commento}[1]{}
\newcommand{\Lagr}{\mathcal{L}}
%{\bfseries #1 \medskip}
\newcommand{\transv}{transverse asymmetry }
\pagestyle{headings}
\sidecaptionvpos{figure}{t}
%\setlength\intextsep{2pt}
\setlength{\textfloatsep}{10pt plus 1.0pt minus 1.0pt}
\author{Adriano del Vincio}
\begin{document}
\begin{figure}[!ht]
\captionsetup[subfloat]{farskip=0pt,captionskip=0.5pt}
\subfloat[][]{% <== remove extra space here
\includegraphics[width = 0.33\textwidth]{example-image-a.pdf}}
\subfloat[][]{% <== remove extra space here
\includegraphics[width = 0.33\textwidth]{example-image-b.pdf}}
\subfloat[][]{% <== remove extra space here
\includegraphics[width = 0.33\textwidth]{example-image-c.pdf}}
\caption{Histogram of the Asymmetry for Detector B. The Asymmetries are corrected removing the data without polarization. The raw asymmetries are multiplied by $\frac{1}{P}$}
\label{fig:AsymmtriesB0B1B2}
\end{figure}
\end{document}
2
  • Really strange, for me it still not working. I'm compiling with lualatex. Commented Jun 28, 2023 at 17:58
  • @AdrianoDelVincio Wrap the command \fbox around \includegraphics, like so: \fbox{\includegraphics{...}}. This will draw the border of the image. Any space that you see inside is part of the image, and has to be cropped by image processing software or by the parameters of \includegraphics.
    – gernot
    Commented Jun 28, 2023 at 18:02
0

Try the following:

\documentclass{article}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}% For dummy text. Don't use in a real document

\usepackage{subcaption}
\usepackage[demo]{graphicx}

\begin{document}
\begin{figure}[ht]
%\captionsetup[subfloat]{farskip=0pt,captionskip=0.5pt}
%\centering
\setkeys{Gin}{width = 0.33\textwidth}
\subfloat[][]{\includegraphics{Analysis/Histogram/B0.pdf}}\hfill%
\subfloat[][]{\includegraphics{Analysis/Histogram/B1.pdf}}\hfill%
\subfloat[][]{\includegraphics{Analysis/Histogram/B2.pdf}}
\caption{Histogram of the Asymmetry for Detector B. The Asymmetries are corrected removing the data without polarization. The raw asymmetries are multiplied by $\frac{1}{P}$}
\label{fig:AsymmtriesB0B1B2}
\end{figure}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .