# Is there a simple way to place float side by side in Lyx?

Hello everyone. When I want to place float side by side in Lyx,which is shown in the picture, I need to add a float-figure first, then add two box, and a(maybe three)\hfill, which is very inconvenient. Is there a simple way to do this in Lyx, so I can only press one or two bottom?

Thanks!

PS: I don't want to use ERT, I want the method that is simpler than I describe above, and can preview the image in Lyx like in the picture.

Thank you!

May be you want this (captions aligned and images top-aligned)?

\documentclass[11pt,a4paper]{book}
\usepackage[utf8]{inputenc} %
\usepackage{geometry}
\usepackage{floatrow, graphicx}

\begin{document}

\begin{figure}[!ht]
\begin{floatrow}
\ffigbox[\FBwidth]{\caption{Float 1 on the left side}\label{flt1}}
{\includegraphics[scale=0.6]{pepe-le-pew1}}
\ffigbox[\FBwidth]{\caption{Float 2 on the right side}\label{flt2}}
{\includegraphics{pepe-le-pew2}}
\end{floatrow}
\end{figure}

\end{document}


For example:

\documentclass[a5paper]{report}
\usepackage{graphicx}
\usepackage{caption}
\captionsetup{format=hang}
\begin{document}
\setcounter{chapter}{3}
\begin{figure}
\begin{minipage}[t]{.5\dimexpr\linewidth-\columnsep\relax}
\kern0pt
\centering
\scalebox{6}{$\infty$}
\caption{This float is on the left side}
\end{minipage}\hfill
\begin{minipage}[t]{.5\dimexpr\linewidth-\columnsep\relax}
\kern0pt
\centering
\includegraphics[width=\linewidth]{example-image-a}
\caption{This float is on the right side}
\end{minipage}
\end{figure}
\end{document}


The top alignment is achieved by option t of the minipages together with \kern0pt as first element. Option t aligns at the baseline for the first line/element in the minipage. It would be the symbol and the image, if \kern0pt is not given.

The hanging format of the caption text is realized by package caption with option format=hang.

The width for the minipages are calculated via eTeX's \dimexpr. \linewidth is set to the current line width both inside the float environment and inside the minipages.

• Thank you, but I am not asking for the LaTeX code, I am asking how to do this IN LYX IN A SIMPLE WAY. – Zhang Zimou Jun 18 '16 at 10:00
• @ZhangZimou AFAIK LaTeX code can be used with LaTeX. I am not familiar with LyX. But the answer shows, that it is at least possible to get the desired result. – Heiko Oberdiek Jun 18 '16 at 10:01
• Thank you any way, but it is not I want. – Zhang Zimou Jun 18 '16 at 10:06
• Unless you want to make them two subfigures of the same float figure, the easiest way is probably Ctrl+C, Ctrl+V. – PhilipPirrip Jun 18 '16 at 10:17