使用色调框进行编译时,它figure
显示ERROR
。如何实现sidebyside
(它的意思text
是leftside
和)。我的 MWE 是:figure
rightside
\documentclass{article}
\usepackage{lipsum,fancybox,pbox,graphics}
\usepackage[many]{tcolorbox}
\usepackage{floatrow}
\usepackage{caption}
\usepackage{graphicx}
\makeatletter
\newenvironment{textbyfigure}[2][0.75em]{%
\leavevmode
\begin{Sbox}\hbox{#2}\end{Sbox}%
\settowidth{\figureboxwidth}{\TheSbox}%
\setlength{\textboxwidth}{\linewidth}%
\addtolength{\textboxwidth}{-\figureboxwidth}%
\addtolength{\textboxwidth}{-1.5em}%
\begin{Sbox}\hbox{#2}\end{Sbox}%
\setlength{\saveparskip}{\parskip}
\noindent\begin{minipage}[t]{\textboxwidth}\ignorespaces
}{%
\end{minipage}%
\hfill
\vspace{1ex}
}
\DeclareCaptionFormat{tcbcaption}{%
\begin{tcolorbox}[
nobeforeafter,
enhanced,
colback=white,
arc=0pt,
outer arc=0pt,
boxrule=0pt,
colupper=white,
fontupper=\large\sffamily,
boxsep=0pt,
watermark opacity=1,
watermark graphics=lichtspiel.jpg,
watermark overzoom=1.0
]
#1#2#3
\end{tcolorbox}%
}
\captionsetup{format=tcbcaption,labelformat=empty}
\makeatother
\begin{document}
\lipsum[1]
\lipsum[2]
\begin{figure}
\ffigbox[\FBwidth]
{\includegraphics{16627fig01_02}}
{\caption{how many factors are there in a set of 12?}}
\end{figure}
\begin{textbyfigure}{\begin{figure}
\ffigbox[\FBwidth]{\includegraphics{16627fig01_02}}
{\caption{The
Roman numerals on this stone show the distance to the next village.}}}
Throughout the ages and in different countries, number systems were developed and used to help people
count and communicate with numbers. From the ancient Egyptians to the modern day, different systems have
used pictures and symbols to represent whole numbers. Some of the well-known number systems are the
Egyptian, Babylonian, Roman, modern Chinese and the Hindu-Arabic or decimal system.
\end{textbyfigure}
\end{document}
答案1
以下是与以下内容相关的答案图形标题在浮动内,带有浮动。我给出了您原始环境的替代方案textbyfigure
,但您也可以保留您的版本:
\documentclass{article}
\usepackage{lipsum}
\usepackage[many]{tcolorbox}
\usepackage{caption}
\newcommand{\mygraphics}[3][]{%
\tcbincludegraphics[nobeforeafter,
blanker,hbox,
minipage boxed title*=-6mm,
title={\captionsetup{skip=0pt}\captionof{figure}{#3}},
attach boxed title to bottom center,
boxed title style={enhanced,size=title,sharp corners,
boxrule=0pt,frame hidden,colback=green!50!black!25},
#1]{#2}%
}
\newsavebox\mysavebox
\newenvironment{textbyfigure}[1]{%
\sbox{\mysavebox}{#1}%
\begin{tcolorbox}[blanker,
beforeafter skip=8pt,
sidebyside,sidebyside gap=5mm,
sidebyside align=top,
righthand width=\wd\mysavebox,]%
}{%
\tcblower%
\raisebox{\the\dimexpr-\ht\mysavebox-\dp\mysavebox+\baselineskip/2\relax}{\usebox{\mysavebox}}%
\end{tcolorbox}
}
\begin{document}
\lipsum[1]
\begin{textbyfigure}{
\mygraphics[graphics options={scale=0.4}]{Wing.png}
{The Roman numerals on this stone show the distance to the next village.}}
Throughout the ages and in different countries, number systems were developed
and used to help people count and communicate with numbers. From the ancient
Egyptians to the modern day, different systems have used pictures and symbols to
represent whole numbers. Some of the well-known number systems are the Egyptian,
Babylonian, Roman, modern Chinese and the Hindu-Arabic or decimal system.
\end{textbyfigure}
\lipsum[2]
\end{document}