0

Following layout problems with my document coming from a Tufte-book documentclass, I took into account the new code presented in the following link, which presents the old and the new code: layout problem with \full{\printindex} in Tufte documentclass and Fullwidth figure and table layout on even page in tufte-book documentclass.

As the code proposed in the answer relating to question "Fullwidth figure and table layout on even page in tufte-book documentclass" to solve the table layout problem works, I have taken this one by replacing "Table" by "Figure" in the preamble with lines of code here - below: so as to obtain the following code in order to solve the same layout problems encountered with figures:

    \newenvironment{largefigure}{%
    \@tufte@checkoddpage%
    \ifthenelse{\boolean{@tufte@odd@page}}%
    {\begin{figure}[!htbp]\vspace*{-3ex}\begin{adjustwidth}{}{}\captionatbottommargin}
    {\begin{figure}[!htbp]\vspace*{-3ex}\begin{adjustwidth}{-\marginparwidth-\marginparsep}{\marginparsep}\captionatbottommargin}}       
    {\end{adjustwidth}\end{figure}} 

\makeatother

So as to obtain the following code in order to solve the same layout problems encountered with figures:

% !TeX TS-program = xelatex     

\documentclass[a4paper,nobib,twoside,symmetric,justified,marginals=raggedouter, notoc]{tufte-book}

\makeatletter
\newlength{\oddshift}
\newcommand{\captionatbottommargin}{% from https://tex.stackexchange.com/a/229419/161015
\long\def\@caption##1[##2]##3{%
\par
\addcontentsline{\csname ext@##1\endcsname}{##1}%
{\protect\numberline{\csname the##1\endcsname}{\ignorespaces ##2}}%
\begingroup
\@parboxrestore%
\if@minipage\@setminipage\fi%
\normalsize
\@makecaption{\csname fnum@##1\endcsname}{\ignorespaces ##3}\par
\endgroup}
\long\def\@makecaption##1##2{%
\vskip\abovecaptionskip%
\@tufte@checkoddpage%
\ifthenelse{\boolean{@tufte@odd@page}}%
{\setlength{\oddshift}{\textwidth}\rlap{\hskip\oddshift\parbox{\marginparwidth+\marginparsep}{\hskip0pt\@tufte@caption@font##1: ##2}}}%
{\setlength{\oddshift}{-\marginparwidth- \marginparsep}\rlap{\hskip\oddshift\parbox{\marginparwidth+\marginparsep}{\@tufte@caption@font##1: ##2}}}%
\vskip\belowcaptionskip%
}%
\let\caption\@tufte@orig@caption%
\let\label\@tufte@orig@label}

\newenvironment{largetable}{%
\@tufte@checkoddpage%
\ifthenelse{\boolean{@tufte@odd@page}}%
{\begin{table}[!htbp]\vspace*{-3ex}\begin{adjustwidth}{}{}\captionatbottommargin}%
{\begin{table}[!htbp]\vspace*{-3ex}\begin{adjustwidth}{-\marginparwidth-\marginparsep} {\marginparsep}\captionatbottommargin}}       
    {\end{adjustwidth}\end{table}}    

\newenvironment{largefigure}{%
\@tufte@checkoddpage%
\ifthenelse{\boolean{@tufte@odd@page}}%
{\begin{figure}[!htbp]\vspace*{-3ex}\begin{adjustwidth}{}{}\captionatbottommargin}
{\begin{figure}[!htbp]\vspace*{-3ex}\begin{adjustwidth}{-\marginparwidth-\marginparsep}{\marginparsep}\captionatbottommargin}}       
{\end{adjustwidth}\end{figure}} 

\makeatother

\usepackage{booktabs}

\geometry{% normal pages 
    paperheight  =297mm, paperwidth  = 210mm,  %layout=a4paper
    layoutheight =240mm,layoutwidth  =170mm,
    textheight=38\baselineskip,
    headheight=\baselineskip,
    left=15mm, % right will be the same because of symmetric
    bindingoffset= 5mm, % add space for binding
    textwidth=90mm,
    top=14mm,
    marginparsep=6mm,   marginparwidth=40mm,
    includehead,
    layoutvoffset= 28.5mm,layouthoffset= 20mm,  % 297-240 = 57mm   210-170 = 40mm ->> to center smaller layout in a4
    showframe=true,
    showcrop=true }

\renewenvironment{fullwidth}
{\newgeometry{% full width pages
        layoutheight =240mm,layoutwidth  =170mm,
        textheight=38\baselineskip,
        headheight=\baselineskip,
        left=15mm, % right will be the same because of symmetric
        bindingoffset= 5mm, % add space for binding 
        textwidth=136mm, % 90+ 6+ 40
        top=14mm,
        marginparsep=0mm,   marginparwidth=0mm, %changed to full width <<<<<<<<<<
        includehead,
        layoutvoffset= 28.5mm,layouthoffset= 20mm,  % 297-240 = 57mm   210-170 = 40mm ->> to center smaller layout in a4
        showframe=true,
        showcrop=true }
    \fancyhfoffset[LE]{0pt}
    \fancyhfoffset[RO]{0pt}
}   
{\restoregeometry}%

\usepackage{kantlipsum} % dummy text added
\RequirePackage{showframe} % margin lines <<<<<<<<<<<<<<<<<<<<<<<<<
\renewcommand\ShowFrameLinethickness{0.1pt}
\renewcommand\ShowFrameColor{\color{red}}

\newcommand{\textls}[2][5]{%
    \begingroup\addfontfeatures{LetterSpace=#1}#2\endgroup
}

\renewcommand{\allcapsspacing}[1]{\textls[15]{#1}}
\renewcommand{\smallcapsspacing}[1]{\textls[10]{#1}}
\renewcommand{\allcaps}[1]{\textls[15]{\MakeTextUppercase{#1}}}
\renewcommand{\smallcaps}[1] {\smallcapsspacing{\scshape\MakeTextLowercase{#1}}}
\renewcommand{\textsc}[1]{\smallcapsspacing{\textsmallcaps{#1}}}

\usepackage{fontspec}
\usepackage{libertine} %<<<<<<<<<<<<<<<<
\setsansfont{TeX Gyre Heros}[Scale=MatchUppercase]  

\usepackage{xspace}
\newcommand{\monthyear}{%
    \ifcase\month\or janvier\or f\'{e}vrier\or mars\or avril\or mai\or juin\or
    juillet\or ao\^{u}t\or septembre\or octobre\or novembre\or
    d\'{e}cembre\fi\space\number\year
}

\newcommand{\blankpage}{\newpage\hbox{}\thispagestyle{empty}\newpage}

\usepackage[english,french]{babel}
\frenchbsetup{StandardLayout=true}
\addto\captionsfrench{\def\tablename{Tableau}}
\addto\captionsfrench{\def\figurename{Figure}}

\frenchbsetup{IndentFirst=false}

\usepackage{csquotes}

\begin{document}
    \frenchspacing

    \mainmatter

    9. \kant[9]

\begin{largefigure}
\includegraphics[width=\linewidth]{Figure_1.1.pdf}%
\caption{Périodes de datation des diff\'{e}rentes copies originales de la Pi\`{e}ce d'Orgue BWV 532.}%
  \label{fig:Synoptique}%
\end{largefigure}

11. \kant[11]

    
\end{document}

The results obtained are as follows (see the figures below, with the original images inserted in the figures):

  • Page 17: Figure 1.1 should be full width, but it is displayed only on the width of the text,
  • Page 20: the following figures are indeed in full width, but they should be aligned on the right on the text, but it seems that they are justified on the left (the same problem is observed for the tables),
  • I would like the legend width to be only on marginparwitdth and not marginparwidth+marginparsep. I would have managed to reduce the width of the caption text, but it remains in the marginparsep margin. What should I change to get this result?

Page_17 Page_20

Figure_1.1[6][PraeludioFuga

The answer above solved the problem for all tables and figures in my document, except for one figure where I get the following result: Fig.13 example

Where can the problem come from? Here is the figure to insert: Figure_2.13

3
  • Your MWE defines largefigure but uses largetable. Mar 8, 2022 at 22:54
  • The MWE is updated. Thanks
    – Phil8544
    Mar 17, 2022 at 9:25
  • @Phil8544 Please see the update II. Mar 26, 2022 at 17:42

1 Answer 1

2

UPDATED Captions width = marginparwidth & tall figures.

Figures (and tables) are floating: if they don't fit in the space left on the page, they are written on the next page.

In this case, the change from odd to even page or vice versa is not detected.

If this happens add \newpage before the big figure to help the detection and compile twice.

y

z

% !TeX TS-program = xelatex     

\documentclass[a4paper,nobib,twoside,symmetric,justified,marginals=raggedouter, notoc]{tufte-book}

\makeatletter
\newlength{\oddshift}
\newcommand{\captionatbottommargin}{% from https://tex.stackexchange.com/a/229419/161015
\long\def\@caption##1[##2]##3{%
    \par
    \addcontentsline{\csname ext@##1\endcsname}{##1}%
    {\protect\numberline{\csname the##1\endcsname}{\ignorespaces ##2}}%
    \begingroup
    \@parboxrestore%
    \if@minipage\@setminipage\fi%
    \normalsize
    \@makecaption{\csname fnum@##1\endcsname}{\ignorespaces ##3}\par
    \endgroup}
\long\def\@makecaption##1##2{%
    \vskip\abovecaptionskip%
    \@tufte@checkoddpage%
    \ifthenelse{\boolean{@tufte@odd@page}}%
    {\setlength{\oddshift}{\linewidth+\marginparsep}\rlap{\hskip\oddshift\parbox{\marginparwidth}{\hskip0pt\@tufte@caption@font##1: ##2}}}%
    {\setlength{\oddshift}{-\marginparwidth- \marginparsep}\rlap{\hskip\oddshift\parbox{\marginparwidth}{\@tufte@caption@font##1: ##2}}}%
    \vskip\belowcaptionskip%
}%
\let\caption\@tufte@orig@caption%
\let\label\@tufte@orig@label}

\newenvironment{largetable}{%
    \@tufte@checkoddpage%
    \ifthenelse{\boolean{@tufte@odd@page}}%
    {\begin{table}[!htbp]\vspace*{-3ex}\begin{adjustwidth}{}{-\marginparwidth-\marginparsep}\captionatbottommargin}%
    {\begin{table}[!htbp]\vspace*{-3ex}\begin{adjustwidth}{-\marginparwidth-\marginparsep}{}\captionatbottommargin}}       
    {\end{adjustwidth}\end{table}}    
        
\newenvironment{largefigure}{%
    \@tufte@checkoddpage%
    \ifthenelse{\boolean{@tufte@odd@page}}%
    {\begin{figure}[htbp!]\vspace*{-3ex}\begin{adjustwidth}{}{-\marginparwidth-\marginparsep}\captionatbottommargin}%changed <<<<<<
    {\begin{figure}[htbp!]\vspace*{-3ex}\begin{adjustwidth}{-\marginparwidth-\marginparsep}{}\captionatbottommargin}}       
    {\end{adjustwidth}\end{figure}} 

\makeatother

\usepackage{booktabs}
        
\geometry{% normal pages 
    paperheight  =297mm, paperwidth  = 210mm,  %layout=a4paper
    layoutheight =240mm,layoutwidth  =170mm,
    textheight=38\baselineskip,
    headheight=\baselineskip,
    left=15mm, % right will be the same because of symmetric
    bindingoffset= 5mm, % add space for binding
    textwidth=90mm,
    top=14mm,
    marginparsep=6mm,   marginparwidth=40mm,
    includehead,
    layoutvoffset= 28.5mm,layouthoffset= 20mm,  % 297-240 = 57mm   210-170 = 40mm ->> to center smaller layout in a4
    showframe=true,
    showcrop=true }

\renewenvironment{fullwidth}
{\newgeometry{% full width pages
        layoutheight =240mm,layoutwidth  =170mm,
        textheight=38\baselineskip,
        headheight=\baselineskip,
        left=15mm, % right will be the same because of symmetric
        bindingoffset= 5mm, % add space for binding 
        textwidth=136mm, % 90+ 6+ 40
        top=14mm,
        marginparsep=0mm,   marginparwidth=0mm, %changed to full width <<<<<<<<<<
        includehead,
        layoutvoffset= 28.5mm,layouthoffset= 20mm,  % 297-240 = 57mm   210-170 = 40mm ->> to center smaller layout in a4
        showframe=true,
        showcrop=true }
    \fancyhfoffset[LE]{0pt}
    \fancyhfoffset[RO]{0pt}
}   
{\restoregeometry}%

\usepackage{kantlipsum} % dummy text added
\RequirePackage{showframe} % margin lines <<<<<<<<<<<<<<<<<<<<<<<<<
\renewcommand\ShowFrameLinethickness{0.1pt}
\renewcommand\ShowFrameColor{\color{red}}

\newcommand{\textls}[2][5]{%
    \begingroup\addfontfeatures{LetterSpace=#1}#2\endgroup
}

\renewcommand{\allcapsspacing}[1]{\textls[15]{#1}}
\renewcommand{\smallcapsspacing}[1]{\textls[10]{#1}}
\renewcommand{\allcaps}[1]{\textls[15]{\MakeTextUppercase{#1}}}
\renewcommand{\smallcaps}[1] {\smallcapsspacing{\scshape\MakeTextLowercase{#1}}}
\renewcommand{\textsc}[1]{\smallcapsspacing{\textsmallcaps{#1}}}

\usepackage{fontspec}
\usepackage{libertine} %<<<<<<<<<<<<<<<<
\setsansfont{TeX Gyre Heros}[Scale=MatchUppercase]  

\usepackage{xspace}
\newcommand{\monthyear}{%
    \ifcase\month\or janvier\or f\'{e}vrier\or mars\or avril\or mai\or juin\or
    juillet\or ao\^{u}t\or septembre\or octobre\or novembre\or
    d\'{e}cembre\fi\space\number\year
}

\newcommand{\blankpage}{\newpage\hbox{}\thispagestyle{empty}\newpage}

\usepackage[english,french]{babel}
\frenchbsetup{StandardLayout=true}
\addto\captionsfrench{\def\tablename{Tableau}}
\addto\captionsfrench{\def\figurename{Figure}}

\frenchbsetup{IndentFirst=false}

\usepackage{csquotes}

\begin{document}
\frenchspacing

\mainmatter

9. \kant[9] 

\newpage % added <<<<<<<<<<<<<<<<<<<<<<<<<
\begin{largefigure}
    \includegraphics[width=\linewidth,keepaspectratio]{Figure_1.1.jpg}%
    \caption{1 Périodes de datation des diff\'{e}rentes copies originales de la Pi\`{e}ce d'Orgue BWV 532.}%
    \label{fig:Synoptique}%
\end{largefigure}            

\newpage  % added <<<<<<<<<<<<<<<<<<<<<<<<<
\begin{largefigure}
    \includegraphics[width=\linewidth,keepaspectratio]{Figure_1.1.jpg}%
    \caption{2 Périodes de datation des diff\'{e}rentes copies originales de la Pi\`{e}ce d'Orgue BWV 532.}%
    \label{fig:Synoptique2}%
\end{largefigure}
\newpage  % added <<<<<<<<<<<<<<<<<<<<<<<<<

11. \kant[9]

\begin{largefigure}
    \includegraphics[width=\linewidth,keepaspectratio]{Preludio.jpg}%
    \caption{En--tête du prélude inscrit par Lorenz Sichart en 1740.}%
    \label{fig:prelude}%
\end{largefigure}


12. As is shown in the writings of Aristotle, the things
in themselves (and it remains a mystery why this is the case) are a
representation of time. Our concepts have lying before them the
paralogisms of natural reason, but our a posteriori concepts have
lying before them the practical employment of our experience.     

\begin{largefigure}
\includegraphics[width=\linewidth,keepaspectratio]{Fuga.jpg}%
\caption{En--tête de la fugue inscrit par Lorenz Sichart en 1740.}%
\label{fig:fugue}%
\end{largefigure}

13. \kant[13]
                    
\end{document}

UPDATE II a very tall and wide figure.

The figure overflows the page in both directions. It is best to reduce it (with scale) and use a single page for it.

Try

\newpage % added <<<<<<<<<<<<<<<<<<<<<<<<<
\begin{largefigure}
    \includegraphics[scale=0.45]{Figure13.jpg}% changed <<<<<<<<<<
    \caption{Plan formed du passage introductif (mes \`{a} 16) du pr\`{e}lude BWV 532.}%
    \label{fig:Plan}%
\end{largefigure}
\newpage  % added <<<<<<<<<<<<<<<<<<<<<<<<<

This is the full code of update II.

% !TeX TS-program = xelatex     

\documentclass[a4paper,nobib,twoside,symmetric,justified,marginals=raggedouter, notoc]{tufte-book}

%********************************************************************************  UPDATED II
\makeatletter
\newlength{\oddshift}
\newcommand{\captionatbottommargin}{% from https://tex.stackexchange.com/a/229419/161015
\long\def\@caption##1[##2]##3{%
    \par
    \addcontentsline{\csname ext@##1\endcsname}{##1}%
    {\protect\numberline{\csname the##1\endcsname}{\ignorespaces ##2}}%
    \begingroup
    \@parboxrestore%
    \if@minipage\@setminipage\fi%
    \normalsize
    \@makecaption{\csname fnum@##1\endcsname}{\ignorespaces ##3}\par
    \endgroup}
\long\def\@makecaption##1##2{%
    \vskip\abovecaptionskip%
    \@tufte@checkoddpage%
    \ifthenelse{\boolean{@tufte@odd@page}}%
    {\setlength{\oddshift}{\linewidth+\marginparsep}\rlap{\hskip\oddshift\parbox{\marginparwidth}{\hskip0pt\@tufte@caption@font##1: ##2}}}%
    {\setlength{\oddshift}{-\marginparwidth- \marginparsep}\rlap{\hskip\oddshift\parbox{\marginparwidth}{\@tufte@caption@font##1: ##2}}}%
    \vskip\belowcaptionskip%
}%
\let\caption\@tufte@orig@caption%
\let\label\@tufte@orig@label}

\newenvironment{largetable}{%
    \@tufte@checkoddpage%
    \ifthenelse{\boolean{@tufte@odd@page}}%
    {\begin{table}[!htbp]\vspace*{-3ex}\begin{adjustwidth}{}{-\marginparwidth-\marginparsep}\captionatbottommargin}%
    {\begin{table}[!htbp]\vspace*{-3ex}\begin{adjustwidth}{-\marginparwidth-\marginparsep}{}\captionatbottommargin}}       
    {\end{adjustwidth}\end{table}}    
        
\newenvironment{largefigure}{%
    \@tufte@checkoddpage%
    \ifthenelse{\boolean{@tufte@odd@page}}%
    {\begin{figure}[htbp!]\vspace*{-3ex}\begin{adjustwidth}{}{-\marginparwidth-\marginparsep}\captionatbottommargin}%changed <<<<<<
    {\begin{figure}[htbp!]\vspace*{-3ex}\begin{adjustwidth}{-\marginparwidth-\marginparsep}{}\captionatbottommargin}}       
    {\end{adjustwidth}\end{figure}} 

\makeatother
%*********************************************************************************************

\usepackage{booktabs}
        
\geometry{% normal pages 
    paperheight  =297mm, paperwidth  = 210mm,  %layout=a4paper
    layoutheight =240mm,layoutwidth  =170mm,
    textheight=38\baselineskip,
    headheight=\baselineskip,
    left=15mm, % right will be the same because of symmetric
    bindingoffset= 5mm, % add space for binding
    textwidth=90mm,
    top=14mm,
    marginparsep=6mm,   marginparwidth=40mm,
    includehead,
    layoutvoffset= 28.5mm,layouthoffset= 20mm,  % 297-240 = 57mm   210-170 = 40mm ->> to center smaller layout in a4
    showframe=true,
    showcrop=true }

\renewenvironment{fullwidth}
{\newgeometry{% full width pages
        layoutheight =240mm,layoutwidth  =170mm,
        textheight=38\baselineskip,
        headheight=\baselineskip,
        left=15mm, % right will be the same because of symmetric
        bindingoffset= 5mm, % add space for binding 
        textwidth=136mm, % 90+ 6+ 40
        top=14mm,
        marginparsep=0mm,   marginparwidth=0mm, %changed to full width <<<<<<<<<<
        includehead,
        layoutvoffset= 28.5mm,layouthoffset= 20mm,  % 297-240 = 57mm   210-170 = 40mm ->> to center smaller layout in a4
        showframe=true,
        showcrop=true }
    \fancyhfoffset[LE]{0pt}
    \fancyhfoffset[RO]{0pt}
}   
{\restoregeometry}%

\usepackage{kantlipsum} % dummy text added
\RequirePackage{showframe} % margin lines <<<<<<<<<<<<<<<<<<<<<<<<<
\renewcommand\ShowFrameLinethickness{0.1pt}
\renewcommand\ShowFrameColor{\color{red}}

\newcommand{\textls}[2][5]{%
    \begingroup\addfontfeatures{LetterSpace=#1}#2\endgroup
}

\renewcommand{\allcapsspacing}[1]{\textls[15]{#1}}
\renewcommand{\smallcapsspacing}[1]{\textls[10]{#1}}
\renewcommand{\allcaps}[1]{\textls[15]{\MakeTextUppercase{#1}}}
\renewcommand{\smallcaps}[1] {\smallcapsspacing{\scshape\MakeTextLowercase{#1}}}
\renewcommand{\textsc}[1]{\smallcapsspacing{\textsmallcaps{#1}}}

\usepackage{fontspec}
\usepackage{libertine} %<<<<<<<<<<<<<<<<
\setsansfont{TeX Gyre Heros}[Scale=MatchUppercase]  

\usepackage{xspace}
\newcommand{\monthyear}{%
    \ifcase\month\or janvier\or f\'{e}vrier\or mars\or avril\or mai\or juin\or
    juillet\or ao\^{u}t\or septembre\or octobre\or novembre\or
    d\'{e}cembre\fi\space\number\year
}

\newcommand{\blankpage}{\newpage\hbox{}\thispagestyle{empty}\newpage}

\usepackage[english,french]{babel}
\frenchbsetup{StandardLayout=true}
\addto\captionsfrench{\def\tablename{Tableau}}
\addto\captionsfrench{\def\figurename{Figure}}

\frenchbsetup{IndentFirst=false}

\usepackage{csquotes}

\begin{document}
\frenchspacing

\mainmatter

9. \kant[9] 

\newpage % added <<<<<<<<<<<<<<<<<<<<<<<<<
\begin{largefigure}
    \includegraphics[scale=0.45]{Figure13.jpg}%
    \caption{Plan formed du passage introductif (mes \`{a} 16) du pr\`{e}lude BWV 532.}%
    \label{fig:Plan}%
\end{largefigure}
\newpage  % added <<<<<<<<<<<<<<<<<<<<<<<<<

10. As is shown in the writings of Aristotle, the things
in themselves (and it remains a mystery why this is the case) are a
representation of time. Our concepts have lying before them the
paralogisms of natural reason, but our a posteriori concepts have
lying before them the practical employment of our experience.            

\newpage  % added <<<<<<<<<<<<<<<<<<<<<<<<<
\begin{largefigure}
    \includegraphics[scale=0.45]{Figure13.jpg}%
    \caption{Plan formed du passage introductif (mes \`{a} 16) du pr\`{e}lude) BWV 532.}%
    \label{fig:Synoptique2}%
\end{largefigure}

11. \kant[9]

\end{document}
            

zz

6
  • I've updated my question to show the issues I'm having. Could you help me please?
    – Phil8544
    Mar 24, 2022 at 11:02
  • 1
    @Phil8544 Please try the updated code. If necessary add \newpage before a tall figure and compile twice. Mar 24, 2022 at 16:58
  • Just one more question on this problem in my answer.
    – Phil8544
    Mar 26, 2022 at 16:50
  • scale do not reduce the figure on my document... but I use [width=0.956\linewidth] and it works !
    – Phil8544
    Mar 28, 2022 at 22:45
  • @Phil8544 Very glad to hear that! Just in case please (1) Test the full code of Update II in your system (it use scale= I hope it works. (2) Update the patch, from \makeatletter to \makeatother in your code, because I corrected the largetable. Mar 29, 2022 at 17:50

You must log in to answer this question.

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