![买者自负 ...](https://linux22.com/image/339137/%E4%B9%B0%E8%80%85%E8%87%AA%E8%B4%9F%20....png)
我正在使用 Tufte-book,但我需要一个新的类似图形的环境,带有星号全宽选项。这是一个例子
\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}
感谢您的帮助
答案1
/Mynewfloat
包能够为tufte
文档类定义新的浮动环境:
\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}
答案2
我认为你需要模拟该类配置浮动环境的方式。不过请注意,我根本不了解这个类。
买者自负 ...
\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}