# Sidecaption layout question using sidelegend memoir

Linked to this previous post, i make some tests to have more elegant sidecaption using memoir class.

I try to reproduce this layout, with two type of caption style :

• a normal centered caption with legend aligned to the title,
• and a sidecaption with possible sidelegend. Title are ragged to the left and aligned with the legend float. Text in the sidelegend float is justified.

I found the \sidelegend command in memoir class documentation, but i found no example of usage in my case.

A MWE :

\documentclass[a4paper, 11pt,twoside, openright]{memoir}
\usepackage{polyglossia}
\setdefaultlanguage{french}
\setotherlanguage{english}
\usepackage{fontspec}
\usepackage{xparse}
\usepackage{graphicx}
\usepackage{ragged2e}
\usepackage{mwe} % just for dummy images
\usepackage{lipsum}
\usepackage{showframe} % just to display frame

\sidecapmargin{outer}
\setsidecappos{t}

\renewcommand*{\sidecapstyle}{%
\ifscapmargleft
\captionstyle{\raggedright\scriptsize}%
\else
\captionstyle{\raggedright\scriptsize}%
\fi}

\makeatletter
\renewcommand{\fnum@figure}{\scriptsize\textbf{Figure~\thefigure~--}}
\makeatother

\begin{document}

\begin{figure}[h]
\begin{sidecaption}[fortoc]{A long graphic title 1 \\[2ex] A very long legend with multiple citations, and multiple authors, and some blablabla }[fig:S_OverviewOptimisation1]
\centering
\includegraphics[width=.9\linewidth]{example-image}
\end{sidecaption}
\end{figure}

\lipsum[1-3]

\begin{figure}[h]
\begin{sidecaption}[fortoc]{A long graphic title 2 \\[2ex] A very long legend with multiple citations, and multiple authors, and some blablabla }[fig:S_OverviewOptimisation2]
\centering
\includegraphics[width=.9\linewidth]{example-image}
\end{sidecaption}
\end{figure}

\lipsum[1-3]

\begin{figure}[h]
\centering
\includegraphics[width=.9\linewidth]{example-image}
\caption{A long graphic title 3}
\legend{A very long legend with multiple citations, and multiple authors, and some blablabla }
\end{figure}

\lipsum[1-3]

\end{document}


I try to reproduce the stylized layout, so i need to understand how can i separate alignement for figure (ragged right or left?), and alignement for legend text (justified)

There is a command nammed \sidelegend in memoir class, but i don't understand how this command work to obtain this behavior, and how can i justify text ?

• Thank you for posting a working example! At the same time, much of your code does not seem to be relevant to the question you're asking here. Please limit the example to only the code required for your issue to appear. You can have a look at this guide for how to prune your code for this purpose. Also, always use \usepackage[demo]{graphicx}! – DG' Jan 27 '15 at 13:41
• MWE updated, i hope this is better :) – reyman64 Jan 27 '15 at 13:50
• And what exactly is(are) the problem(s) you haven't been able to solve? Could you please add to your post an actual question describing what you haven't been able to achieve? – Gonzalo Medina Jan 27 '15 at 15:34
• I update the question with my problem – reyman64 Jan 27 '15 at 15:44