2

I am trying to place Young diagrams (using youngtab) in the margin, as in the tufte-book document class.

I have tried the obvious

\begin{figure}
\centering
 $\young(\hfil\hfil\hfil\hfil\hfil,\hfil\hfil\hfil\hfil,\hfil\hfil,\hfil\hfil)$
  \caption{Diagram of shape $(5,4,2,2)$}\label{fig:diagramExample}
\end{figure}

But this does not work; the diagram is centred in the middle, and not at the side. I also get the error message "figure with no caption on input line xx".

If I use say amsart document class, then everything works as expected.

So, what is the solution to this problem? I would appreciate a solution which makes it easy to switch back to amsart if I would like to.

EDIT:

So this is part of my preable:

\documentclass[symmetric,sfsidenotes,numbers]{tufte-book}
\usepackage{amsmath,amssymb,amsthm,latexsym,enumerate,youngtab}
\usepackage{epigraph,graphicx}

The result I get is as below, but I want the diagram to appear on the left hand side, like a normal pictures A picture describing my output

Minimal example

\RequirePackage[l2tabu, orthodox]{nag}
\documentclass[sfsidenotes,numbers]{tufte-book}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{microtype}
\usepackage{amsmath,amssymb,amsthm,latexsym,enumerate,youngtab}
\usepackage{epigraph,graphicx}

\title{Minimal}
\author{John Doe}

\begin{document}
\maketitle
\begin{figure}
   \centering
    $ e^x $
  \caption{Caption here}\label{fig:skewDiagramExample}
\end{figure}
\end{document}
6
  • It works fine for me. can you add some more info? Jan 28, 2014 at 19:38
  • I realized that what I want is "marginfigure". But I still get the "figure with no caption" warning. Jan 28, 2014 at 19:58
  • Hm, no, the warnings disappeared. But, with ordinary "figure" environmen, I get the warning. Can I get rid of that? Jan 28, 2014 at 20:06
  • I get no such warnings in either case. Can you post a complete minimal document. Jan 28, 2014 at 20:15
  • Ok, @AndrewSwann, I have added a minimal example. Jan 28, 2014 at 20:44

1 Answer 1

3

To put figures in the margin, one uses marginfigure instead of figure:

Sample output

\documentclass[sfsidenotes,numbers]{tufte-book}

\usepackage{youngtab}

\usepackage{lipsum} %For dummy text

\begin{document}

\lipsum[1]
\begin{figure}
\centering
 $\young(\hfil\hfil\hfil\hfil\hfil,\hfil\hfil\hfil\hfil,\hfil\hfil,\hfil\hfil)$
  \caption{Diagram of shape $(5,4,2,2)$}\label{fig:diagramExample}
\end{figure}
\lipsum[2]
\begin{marginfigure}
\centering
 $\young(\hfil\hfil\hfil\hfil\hfil,\hfil\hfil\hfil\hfil,\hfil\hfil,\hfil\hfil)$
  \caption{Diagram of shape $(5,4,2,2)$}\label{fig:diagramExample2}
\end{marginfigure}
\lipsum[3]

\end{document}

There is nothing specific to Yound diagrams in this. The only warning the above code produces in the log file is related to the bibentry package, and not to any of the figures. On the other hand adding

\RequirePackage[l2tabu, orthodox]{nag}

writes

Package nag Warning: figure with no \caption on input line 15.

in the .log file. The nag package doesn't know about the tufte documentclasses, which redefines the figure environment to put the caption in the margin. As the nag documentation says

Be warned, that this package will possibly balk at legitimate use, and not find illegitimate use in all cases. It is a tool, not a replacement for study of l2tabu.

However, you can teach nag to deal correctly with your situation by making it recognise \@tufte@caption as a caption command:

\RequirePackage[l2tabu, orthodox]{nag}
\documentclass[sfsidenotes,numbers]{tufte-book}

\usepackage{youngtab}

\usepackage{lipsum} %For dummy text

\makeatletter
\g@addto@macro\nag@captions{,@tufte@caption}
\makeatother

\begin{document}

\lipsum[1]
\begin{figure}
\centering
 $\young(\hfil\hfil\hfil\hfil\hfil,\hfil\hfil\hfil\hfil,\hfil\hfil,\hfil\hfil)$
  \caption{Diagram of shape $(5,4,2,2)$}\label{fig:diagramExample}
\end{figure}
\lipsum[2]
\begin{marginfigure}
\centering
 $\young(\hfil\hfil\hfil\hfil\hfil,\hfil\hfil\hfil\hfil,\hfil\hfil,\hfil\hfil)$
  \caption{Diagram of shape $(5,4,2,2)$}\label{fig:diagramExample2}
\end{marginfigure}
\lipsum[3]

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .