0

Fully compilable code here.

I am placing a figure with

\newcommand{\plainwidefig}[5][!htb]{%
    \FloatBarrier%
    \begin{figure*}[#1]%
        {\includegraphics[width=#2\linewidth, left]{#3}}%
        \caption{#4\label{#5}}%
    \end{figure*}%
}

\plainwidefig{1}{fig1.pdf}{Figure caption}{fig:fig1}

I would suppose that figure* would make it span into the margin notes, but that's not quite what happens: result of the previous command

How should I change that \plainwidefig? I have tried with \centerline but that didn't solve it. Here is the layout for even and odd pages for reference:

Odd page layout Even page layout

Also, for completion, I am using tufte-style-thesis and not tufte-latex.

Thank you so much!

Ax11
  • 3
  • 2
  • Welcome to TeX.SE! Please show a short compilable TeX code resulting with your issue, then we do not have to guess what you are doing ... – Mensch Mar 25 '24 at 11:14
  • Hi @Mensch, here is a compilable TeX code. I had to push it to github to add a figure: https://github.com/javirk/example_error You can see that Figure 1 on page 1 is correctly placed, but Figure 2 on page 2 is wrong (it spans into the right margin). – Ax11 Mar 25 '24 at 11:39
  • The class name must correspond to the file name. Either rename your file tufte-style-thesis.cls or change \ProvidesClass{tufte-style-thesis} to \ProvidesClass{tufte-style}. – jlab Mar 25 '24 at 23:05
  • @jlab Sorry, that's solved now. – Ax11 Mar 26 '24 at 08:41

1 Answers1

1

The figure* environment is defined by the sidenotes package which use internally the changepage to detect odd/even pages.

But changepage sometimes fails, if the test falls between two pages like in your case.

You can add a \noindent before the figure which appear a the top of the page to help changepage:

\noindent
\plainwidefig{1}{fig1}{Figure caption}{fig:fig1}

Alternatively, replace sidenotes by sidenoteplus, which seems to handle better this problem.

jlab
  • 1,834
  • 1
  • 13
  • Wow, thank you! Your suggestion of replacing sidenotes by sidenotesplus seems more robust in the long term. Problem solved, thank you! – Ax11 Mar 26 '24 at 08:44
  • 1
    If somebody also stumbles upon this problem and doesn't want to use sidenotesplus, just requiring the package ifoddpage explicitly solves the problem for me. – Ax11 Mar 26 '24 at 10:29