init
This commit is contained in:
parent
cf9c2f63a7
commit
b71b85d49e
3 changed files with 81 additions and 2 deletions
BIN
.resources/screenshot.png
Normal file
BIN
.resources/screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 45 KiB |
39
README.md
39
README.md
|
@ -1,3 +1,40 @@
|
||||||
# poor-mans-subfigure
|
# A Poor Man's Subfigure for REVTeX
|
||||||
|
|
||||||
A subfigure package that works with REVTeX.
|
A subfigure package that works with REVTeX.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
To use, simply put the
|
||||||
|
`.sty` file somewhere where `TeX` will find it, such as next to you
|
||||||
|
`.tex` file.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```TeX
|
||||||
|
\begin{figure*}
|
||||||
|
\begin{multifig}
|
||||||
|
\begin{subfigure}{\columnwidth}{\label{subfig:descriptive-label}Some
|
||||||
|
text label.}
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=.8\columnwidth]{example-image-a}
|
||||||
|
\end{center}
|
||||||
|
\end{subfigure}
|
||||||
|
\begin{subfigure}{\columnwidth}{\label{subfig:another-descriptive-label}Another
|
||||||
|
text label.}
|
||||||
|
\begin{center}
|
||||||
|
\includegraphics[width=.8\columnwidth]{example-image-b}
|
||||||
|
\end{center}
|
||||||
|
\end{subfigure}
|
||||||
|
\end{multifig}
|
||||||
|
\caption{\label{fig:beautiful-figures}As the discerning eye may have
|
||||||
|
spied, the figures \subref{subfig:descriptive-label} and
|
||||||
|
\subref{subfig:another-descriptive-label} have the potential to
|
||||||
|
rock the foundations of society.}
|
||||||
|
\end{figure*}
|
||||||
|
Total nonsense, but I couldn't think of anything better to demonstrate
|
||||||
|
Figure \ref{subfig:descriptive-label} and \ref{subfig:another-descriptive-label}.
|
||||||
|
|
||||||
|
This produces the below result...
|
||||||
|
```
|
||||||
|
|
||||||
|

|
||||||
|
|
42
poormanssubfig.sty
Normal file
42
poormanssubfig.sty
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
\newcounter{subfigure}
|
||||||
|
|
||||||
|
\newcommand{\subfiglabelformat}[1]{\raggedright{#1}}
|
||||||
|
\newcommand{\subfiglabelstyle}[1]{\alph{#1}}
|
||||||
|
\newcommand{\subfiglabelsize}{\small}
|
||||||
|
\newenvironment{multifig}%
|
||||||
|
{\addtocounter{figure}{1}%
|
||||||
|
\setcounter{subfigure}{0}%
|
||||||
|
\renewcommand\thesubfigure{\thefigure~(\subfiglabelstyle{subfigure})}%
|
||||||
|
}
|
||||||
|
{\addtocounter{figure}{-1}}
|
||||||
|
|
||||||
|
\makeatletter
|
||||||
|
\ExplSyntaxOn
|
||||||
|
\newif\if@insubfig
|
||||||
|
\NewDocumentEnvironment{subfigure}{mO{}}{%
|
||||||
|
\@insubfigtrue%
|
||||||
|
\refstepcounter{subfigure}%
|
||||||
|
\begin{minipage}{#1}%
|
||||||
|
\subfiglabelformat{{\subfiglabelsize (\subfiglabelstyle{subfigure})~#2}}%
|
||||||
|
}
|
||||||
|
{\end{minipage}%
|
||||||
|
\@insubfigfalse%
|
||||||
|
}
|
||||||
|
\ExplSyntaxOff
|
||||||
|
|
||||||
|
\let\multifig@old@label\label%
|
||||||
|
\def\label#1{%
|
||||||
|
\multifig@old@label{#1}%
|
||||||
|
\if@insubfig%
|
||||||
|
\@bsphack%
|
||||||
|
\protected@write\@auxout{}%
|
||||||
|
{\string\newlabel{#1@multifig}{{(\subfiglabelstyle{subfigure})}%
|
||||||
|
{\thepage}%
|
||||||
|
{\@currentlabelname}%
|
||||||
|
{\@currentHref}{}%
|
||||||
|
}}%
|
||||||
|
\@esphack%
|
||||||
|
\fi
|
||||||
|
}%
|
||||||
|
\def\subref#1{\ref{#1@multifig}}
|
||||||
|
\makeatother
|
Loading…
Add table
Reference in a new issue