0

I use the package caption to set the caption of float. I want to get a large label of captions placing in margin, so I need change the distance of caption title and its label (the default is a \nobreakspace).enter image description here

---EDIT---

The MWE is:

\documentclass{article}

\usepackage{caption,wrapfig,lipsum,marginnote}

\captionsetup[wrapfigure]{
labelsep=newline,
labelfont={bf},
position=top,
skip=0pt,
singlelinecheck=no}
\begin{document}
\lipsum[1]
\begin{wrapfigure}{r}[0pt]{4cm}\raggedleft
\marginnote{
\captionof{figure}
{Here is a caption text.}}
\fbox{\parbox{4cm}{aaa\\
bbb\\
ccc\\
ddd\\
eee\\
fff\\
ggg
}}
\end{wrapfigure}
\lipsum[1]

\end{document}

The code above show:

enter image description here

But I want is:

enter image description here

That is say, I want to insert a \newline after Figure and before 1.

  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Mar 21 '15 at 17:48
0

Note, I also fixed the width of the \parbox so that the \fbox would fit inside the margin.

My original solution was simple elegant, and wrong. Specifically, \thefigure is also used in the list of figures. It took a bit of searching, but I believe \fnum@figure is the right macro to modify.

\documentclass{article}
\usepackage{caption,wrapfig,lipsum,marginnote}

\makeatletter
\renewcommand{\fnum@figure}{\figurename\newline\centerline{\huge\thefigure}}
\makeatother

\captionsetup[wrapfigure]{
labelsep=newline,
labelfont={bf},
position=top,
skip=0pt,
singlelinecheck=no}
\begin{document}
\lipsum[1]
\begin{wrapfigure}{r}[0pt]{4cm}\raggedleft
\marginnote{
\captionof{figure}
{Here is a caption text.}}
\fbox{\parbox{\dimexpr 4cm-2\fboxsep-2\fboxrule}{aaa\\
bbb\\
ccc\\
ddd\\
eee\\
fff\\
ggg
}}
\end{wrapfigure}
\lipsum[1]

\end{document}

margin caption

  • Thank you. Any why \renewcommand{\thefigure}{\newline\centerline{abc\huge\arabic{figure}}} don't show the abc? – Tony Pierre Mar 24 '15 at 0:44
  • Did you run it twice? Works for me. – John Kormylo Mar 24 '15 at 3:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.