4

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

5
  • Could you explain some more what you want? I see a table which is suppose to explain, but only makes me confused. Do you want to align the images to eachother?
    – Runar
    Aug 13, 2016 at 17:58
  • Yes, I want another enviroment with the full width option, then \begin{example*}-> I need this works like \begin{figure*}-> this is a figure in full width thanks Aug 13, 2016 at 17:59
  • okey, does that mean that you don't want to align the images to eachother? and by full width, do you mean the textarea + margin? Where do you want your caption?
    – Runar
    Aug 13, 2016 at 18:09
  • Yes Runar I want this new enviroment without asterisk in text area and with it in text area+margin. Aug 13, 2016 at 18:12
  • Related: tex.stackexchange.com/questions/199812/…
    – Runar
    Aug 13, 2016 at 19:53

2 Answers 2

2

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}
1

You need to emulate the way that the class configures the floating environments, I think. Note, however, that I don't know this class at all.

Caveat emptor ...

\documentclass{tufte-book}
\usepackage{framed,xcolor}
\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}

% modified from tufte-common.def
\newsavebox{\@tufte@example@box}
\newenvironment{marginexample}[1][-1.2ex]%
  {\begin{@tufte@margin@float}[#1]{example}}
  {\end{@tufte@margin@float}}    
\newenvironment{example}[1][htbp]%
  {\ifvmode\else\unskip\fi\begin{@tufte@float}[#1]{example}{}}
  {\end{@tufte@float}}
\newenvironment{example*}[1][htbp]%
  {\ifvmode\else\unskip\fi\begin{@tufte@float}[#1]{example}{star}}
  {\end{@tufte@float}}

\let\l@example\l@figure
\makeatother

\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}

examples and figures and tables and ...

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.