0

I want to present 4 figures inside one float, so I'm using the following format: enter image description here

Although, when I present this float I get: enter image description here

As you can see, there is a small vertical space between the first "line" to the other. I want the 4 figure to be aligned and symmetric.

Appreciate your help, thanks!

Note: the lyx file + latexpdf + pdf available in the comments.

Latex code:

% Preview source code for paragraph 0

\begin{figure}
\begin{centering}
\subfloat[]{\includegraphics[width=0.45\columnwidth]{../Documents/MEGA/Technion/Msc/Thesis/Code/code_files/Thesis/images/edges_bias/original_PH}

}\hspace{1px}\subfloat[]{\includegraphics[width=0.45\columnwidth]{../Documents/MEGA/Technion/Msc/Thesis/Code/code_files/Thesis/images/edges_bias/composed_PH}}\\\subfloat[]{\includegraphics[width=0.45\columnwidth]{../Documents/MEGA/Technion/Msc/Thesis/Code/code_files/Thesis/images/edges_bias/original_PH}

}\hspace{1px}\subfloat[]{\includegraphics[width=0.45\columnwidth]{../Documents/MEGA/Technion/Msc/Thesis/Code/code_files/Thesis/images/edges_bias/composed_PH}}
\par\end{centering}
\centering{}\caption{Description: (a) (b) (c) (d)}
\label{fig:filtering_process}
\end{figure}
roishik
  • 123
  • Welcome, can you boil down your LyX document to just this and upload the lyx file? The exported pdflatex file would be great as well. – Johannes_B Jan 15 '17 at 07:37
  • Hi, I don't know how to add files, but I can share this link: https://drive.google.com/open?id=0B3qnsDa7ZucCZVE1ZWZ6aksydmc – roishik Jan 15 '17 at 07:51
  • Please add the content of the files. They should be rather short, as everything else is removed. Open them with a simple text editor. – Johannes_B Jan 15 '17 at 07:52
  • @Mico Just to be sure, i can see \newline in the screenshot. It is even in the title. – Johannes_B Jan 15 '17 at 10:40
  • @Johannes_B - Ah, i had overlooked the newline string in the title! I still believe, though, that the OP ought to have made more of an effort to post the code in the query itself, to make it more accessible and user-friendly. If you believe the query merits re-opening, please go ahead. – Mico Jan 15 '17 at 11:12
  • I added the code. Sorry didn't do it before, I needed to check how :) (First time on lyx, after long years with Office Word XD) – roishik Jan 15 '17 at 12:07

2 Answers2

1

Ok, I guess I solved it. I don't know why, but apparently using \\ instead of \newline just solved the problem (didn't create the space).

The difference between \ and \newline detailed here.

enter image description here

Thank you all anyway :)

roishik
  • 123
1

Do yourself some favors:

  1. Use a macro instead of repeating umpteen times a long path.

  2. Don't rely on dubious sources for LaTeX code.

  3. Don't use \newline or \\ when not needed; by the way, \newline should never be used in a \centering context.

  4. Don't use px, because you don't know how big it is.

The centering environment doesn't exist as such; there is the \centering declaration.

In the following example I used the demo option to graphicx because I don't have your images.

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{subfig}

\newcommand{\figurepath}{%
  ../Documents/MEGA/Technion/Msc/Thesis/Code/code_files/Thesis/images%
}

\begin{document}

\begin{figure}
\centering

\subfloat[]{\includegraphics[width=0.45\columnwidth]{\figurepath/edges_bias/original_PH}}\quad
\subfloat[]{\includegraphics[width=0.45\columnwidth]{\figurepath/edges_bias/composed_PH}}

\subfloat[]{\includegraphics[width=0.45\columnwidth]{\figurepath/edges_bias/original_PH}}\quad
\subfloat[]{\includegraphics[width=0.45\columnwidth]{\figurepath/edges_bias/composed_PH}}

\caption{Description: (a) (b) (c) (d)}
\label{fig:filtering_process}

\end{figure}

\end{document}

enter image description here

egreg
  • 1,121,712