# Change color for captions in sidenotes and alignment

I'm making my thesis with classicthesis but in a style very similar to the Tufte-book. Large margin with sidenotes and images.

I'm using the sidenotes package.

I want to change the color of the captions label (Figure 1.1:) of the figures in the margin. I've tried all sort of option in the caption package but the result is the same.

The normal figure caption is colored like I want, but all the captions in the marginfigure or margintable are back to the basic style, black text and not bold.

\DeclareCaptionFont{captioncolor}{\color{mymaroon}}
\captionsetup{labelfont={captioncolor,bf}}


Doesn't work.

\usepackage[font={color=mymaroon,bf}]{caption}


Doesn't work.

\captionsetup[figure]{labelfont={color=blue}}


Doesn't work.

All of the above change the classic figure environment (and this is good) but not the ones in the margin.

There is a way to redefine some code in the sidenotes package to edit the style of the captions? I've looked in the documentation but I don't understand which option of the sidecaptions I need to change.

I thought that all of the options for captions and figures used in the sidenotes package were processed with the normal caption or figure environment. But also without call [figure] in the caption option to make it general for all of the possible caption in the document, the color is only changed in all of the captions in the basic figure environment, and not in the margin.

EDIT: Another "problem". When I insert a marginfigure in the first page of a chapter, the image is vertically aligned with the title of the chapter and not with the textblock. There is an option to automatically align text and image without specifying a precise offset?

A similar thing happen when using marginfigure on even page, the figures are all aligned to the outer margin and not to the text. How can I center or align all the figure and caption inside the marginfigure environment? Because sometimes is useful to have all the image very near the outermargin and with a large space between them and the text. In other case is more useful to have the image very near the text or centered in the margin column.

I attach an image that summarise what I want (the second image is inserted randomly only to show the caption label).

• The margin figure (and its caption) is has probably a different name than figure. Look up what classicthesis uses and modify accordingly. For sidecaption it is SCfigure, for wrapfigure it's wrapfigure, etc. – Oleg Lobachev Oct 6 '17 at 12:32
• I don't know if there is a problem with classicthesis. For what I know is the definition of the margin caption inside the sidenotes package. I've read inside the documentation this code: page 5 of sidenotes documentation, too long to put it here, the one for \sidecaption. But I don't know how to edit the first line inside my document preamble. If I copy the code inside a \makeatletter \makeatother with the color option, I got an error that the command is already defined. If I use \renewcommand{sidecaption}{ chunk of code here } The error is the same. – DrewEugene17 Oct 6 '17 at 14:55
• Try putting \captionof{figure} inside a \sidenote. Also \marginparsep=0pt – John Kormylo Oct 6 '17 at 16:18
• I've already tried, I obtain the basic caption, like the captionof{figure} is ignored. Now I'm going to try with the \marginparsep. – DrewEugene17 Oct 6 '17 at 16:24
• It seems that the geometry is off. Like, too little space from the end of side note to the trim line and too much space between side note block and main text block. Packages like geometry might help, again, memoir has its own methods there. – Oleg Lobachev Oct 6 '17 at 19:07

I've found a solution for the first problem, the color.

\captionsetup[sidenotes]{labelfont={color=mymaroon}}

\DeclareCaptionStyle{widefigure}{options=sidenotes}
\DeclareCaptionStyle{marginfigure}{options=sidenotes}
\DeclareCaptionStyle{sidecaption}{options=sidenotes}
\DeclareCaptionStyle{margintable}{options=sidenotes}
\DeclareCaptionStyle{widetable}{options=sidenotes}


And this actually work too:

\DeclareCaptionStyle{marginfigure}{labelfont={color=mymaroon}}
\DeclareCaptionStyle{sidecaption}{labelfont={color=mymaroon}}
\DeclareCaptionStyle{widefigure}{labelfont={color=mymaroon}}
\DeclareCaptionStyle{margintable}{labelfont={color=mymaroon}}
\DeclareCaptionStyle{widetable}{labelfont={color=mymaroon}}


Now I only need to think why sidenotes on the even page use the external margin to align the images. All the sidenotes (footnote + footcite) and the "example environment" (that use a marginfigure) that I have created are well aligned both on even and odd page near the text. The marginfigure with actual images inside is the only one that align to the external side of the page on even page, with only one image too.

EDIT2: Another workaround, if I use inside the marginfigure \flushright then all the images are well aligned near the text. The captions however are all in the same place as when I take the screen for my question. Ho can I align to right the caption too? I need a way to tell the caption of the sidenotes package that with twoside document the caption and figure need to be aligned to the left and to the right in odd and even pages...

EDIT3: The ideal solution should be: \raggedouter to typeset marginal text in twoside book

But if I use that in the option of marginfigure I get a bunch of error with the text of the caption... maybe is not compatible with sidenotes.

For the vertical alignment in the new chapter page I found a little control using an offset value, but is really not perfect. It's like the marginfigure it's using the header top margin of the chapter title and not the top margin of the block of text.

EDIT: Workaround for this one.

\begin{marginfigure}
\vskip95pt\includegraphics[width=0.90\marginparwidth]{arealelacertidi}\captionof{figure}{Distribuzione \emph{Lacertidae} \\ \parencite{vitt2013herpetology}}\label{fig:arealelacertidi}
\end{marginfigure}


With \vskip95pt I align the block of text with the image. Maybe is slightly off but with a zoom of 200% is like perfect too...