scribble-enhanced/pkgs/scribble-pkgs/scribble-lib/scriblib/figure.tex
Matthew Flatt e4d4904298 scriblib/figure: fix figures as ref targets
Merge to v6.0

original commit: a794ef862ec462bcc43d30d9f1b4829cbf53f1ba
2013-12-05 07:33:17 -07:00

43 lines
1.4 KiB
TeX

\usepackage{ccaption}
% \legend relies on \belowcaptionskip, which is not defined
% by the JFP class file:
\makeatletter
\@ifundefined{belowcaptionskip}{\newlength{\belowcaptionskip}}{}
\makeatother
\newcommand{\Legend}[1]{~
\hrule width \hsize height .33pt
\vspace{4pt}
\legend{#1}}
\newcommand{\LegendContinued}[1]{\Legend{#1}}
\newcommand{\FigureTarget}[2]{#1}
\newcommand{\FigureRef}[2]{\hyperref[#2]{#1}}
\newlength{\FigOrigskip}
\FigOrigskip=\parskip
% Put this before the figure content, so that a hyperref goes to
% the start of the content:
\newcommand{\FigureSetRef}{\refstepcounter{figure}}
\newenvironment{Figure}{\begin{figure}\FigureSetRef}{\end{figure}}
\newenvironment{FigureMulti}{\begin{figure*}[t!p]\FigureSetRef}{\end{figure*}}
\newenvironment{FigureMultiWide}{\begin{FigureMulti}\FigureSetRef}{\end{FigureMulti}}
\newenvironment{Herefigure}{\begin{figure}[ht!]\FigureSetRef\centering}{\end{figure}}
\newenvironment{Centerfigure}{\begin{Xfigure}\centering\item}{\end{Xfigure}}
\newenvironment{Leftfigure}{\begin{Xfigure}\item}{\end{Xfigure}}
\newenvironment{Rightfigure}{\begin{Xfigure}\item}{\end{Xfigure}}
\newenvironment{Xfigure}{\begin{list}{}{\leftmargin=0pt\topsep=0pt\parsep=\FigOrigskip\partopsep=0pt}}{\end{list}}
\newenvironment{FigureInside}{}{}
\newcommand{\Centertext}[1]{\begin{center}#1\end{center}}