[Tex/LaTex] Newenviroment with the full width option tufte-book

environmentsfloatsfullwidthtufte

I'm using the Tufte-book but I need a new figure-like environment, with the asterisk full width option. This is an example

\documentclass{tufte-book}
\usepackage{framed, color}
\usepackage{lipsum}
\usepackage{graphicx}

\newcounter{example}[chapter]
\newcommand\examplename{Example}
\newcommand\listexamplename{List of Examples}
\makeatletter
\newcommand\listofexamples{%
\ifthenelse{\equal{\@tufte@class}{book}}%
{\chapter*{\listexamplename}}%
{\section*{\listexamplename}}%
%  \begin{fullwidth}%
\@starttoc{loe}%
%  \end{fullwidth}%
}
\renewcommand\theexample
 {\ifnum \c@chapter>\z@ \thechapter.\fi \@arabic\c@example}
\def\fps@example{tbp}
\def\ftype@example{1}
\def\ext@example{loe}
\def\fnum@example{\examplename\nobreakspace\theexample}
\newenvironment{example}[1][htbp]
  {\begin{@tufte@float}[#1]{example}{}}
  {\end{@tufte@float}}
\let\l@example\l@figure
\makeatother

\begin{document}

\begin{example}
\includegraphics[width=\linewidth]{example-image-a}
\caption{aaaaaaaaaaaaaaaaaaaaa}
\end{example}

\begin{figure*}
\includegraphics[width=\linewidth]{example-image-a}
\caption{aaaaaaaaaaaaaaaaaaaaa}
\end{figure*}

\begin{figure}
\includegraphics[width=\linewidth]{example-image-a}
\caption{aaaaaaaaaaaaaaaaaaaaa}
\end{figure}

\begin{table}
\caption{This is how I want the new float environment caption to behave.}
\centering
\begin{tabular}{llr}
Column 1 & Column 2 & Column 3 \\
Value A1 & Value A2 & Value A3 \\
\end{tabular}
\end{table}

\end{document}

Thanks for your help

Best Answer

The/My newfloat package is able to define new floating environments for tufte document classes:

\documentclass{tufte-book}
\usepackage{framed,xcolor}
\usepackage{graphicx}

\usepackage{newfloat}
\DeclareFloatingEnvironment[fileext=loe]{example}

\begin{document}

\begin{example}
\includegraphics[width=\linewidth]{example-image-b}
\caption{aaaaaaaaaaaaaaaaaaaaa}
\end{example}

\begin{example*}
\includegraphics[width=\linewidth]{example-image-c}
\caption{aaaaaaaaaaaaaaaaaaaaa}
\end{example*}

\begin{figure*}
\includegraphics[width=\linewidth]{example-image}
\caption{aaaaaaaaaaaaaaaaaaaaa}
\end{figure*}

\begin{figure}
\includegraphics[width=\linewidth]{example-image-a}
\caption{aaaaaaaaaaaaaaaaaaaaa}
\end{figure}

\begin{table}
\caption{This is how I want the new float environment caption to behave.}
\centering
\begin{tabular}{llr}
Column 1 & Column 2 & Column 3 \\
Value A1 & Value A2 & Value A3 \\
\end{tabular}
\end{table}

\end{document}
Related Question