summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/easyfig/easyfig.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/easyfig/easyfig.sty')
-rw-r--r--Master/texmf-dist/tex/latex/easyfig/easyfig.sty133
1 files changed, 133 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/easyfig/easyfig.sty b/Master/texmf-dist/tex/latex/easyfig/easyfig.sty
new file mode 100644
index 00000000000..cdd34a5978e
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/easyfig/easyfig.sty
@@ -0,0 +1,133 @@
+%% Copyright (C) 2011 by Martin Scharrer <martin@scharrer.me>
+%% ---------------------------------------------------------------------------
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3
+%% of this license or (at your option) any later version.
+%% The latest version of this license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of LaTeX
+%% version 2005/12/01 or later.
+%%
+%% This work has the LPPL maintenance status `maintained'.
+%%
+%% The Current Maintainer of this work is Martin Scharrer.
+%%
+%% This work consists of the files easyfig.dtx and easyfig.ins
+%% and the derived filebase easyfig.sty.
+%%
+\ProvidesPackage{easyfig}[%
+ 2011/10/31
+ v1.0
+ Easy way to include figures]
+\RequirePackage{adjustbox}
+\RequirePackage{xkeyval}
+\RequirePackage{ifetex}
+\let\easyfig@caption\@gobble
+\let\easyfig@captionabove\@gobble
+\let\easyfig@placement\@empty
+\let\easyfig@default\@empty
+\let\easyfig@default@end\@empty
+\let\easyfig@shortcaption\@empty
+\def\easyfig@env{{figure}}
+\newcommand*{\easyfigdefault}{%
+ \@ifstar
+ {\def\easyfig@default@end}%
+ {\def\easyfig@default}%
+}
+\easyfigdefault*{center}
+\def\easyfig@label#1{%
+ \@ifundefined {easyfig@r@fig:#1}{%
+ \label{fig:#1}%
+ \global\@namedef{easyfig@r@fig:#1}{}%
+ }{}%
+}
+\define@key{easyfig}{caption}{%
+ \def\easyfig@caption##1{\expandafter\caption\easyfig@shortcaption{#1}\easyfig@label{##1}}%
+ \let\easyfig@captionabove\@gobble
+}
+\define@key{easyfig}{shortcaption}{%
+ \def\easyfig@shortcaption{[{#1}]}%
+}
+\define@key{easyfig}{captionabove}{%
+ \let\easyfig@caption\@gobble
+ \def\easyfig@captionabove##1{{%
+ \@tempdima=\abovecaptionskip
+ \abovecaptionskip=\belowcaptionskip
+ \belowcaptionskip=\@tempdima
+ \expandafter\caption\easyfig@shortcaption{#1}%
+ \easyfig@label{##1}%
+ }}%
+}
+\define@key{easyfig}{label}{%
+ \def\easyfig@label##1{\label{#1}}%
+}
+\define@key{easyfig}{placement}{%
+ \def\easyfig@placement{[#1]}%
+}
+\define@key{easyfig}{twocolumn}[true]{%
+ \begingroup
+ \def\@tempa{#1}%
+ \def\@tempb{true}%
+ \ifx\@tempa\@tempb
+ \endgroup
+ \def\easyfig@env{{figure*}}%
+ \else
+ \endgroup
+ \def\easyfig@env{{figure}}%
+ \fi
+}
+\newcommand{\Figure}{%
+ \begingroup
+ \@ifstar
+ {\def\easyfig@env{{figure*}}\@Figure}%
+ {\@Figure}%
+}
+\ifetex
+\def\easyfig@expandonce#1{%
+ \expandafter\unexpanded\expandafter{#1}%
+}
+\newcommand{\@Figure}[2][]{%
+ \edef\@tempa{%
+ \noexpand\setkeys*{easyfig}{%
+ \easyfig@expandonce\easyfig@default,%
+ \unexpanded{#1},%
+ \easyfig@expandonce\easyfig@default@end
+ }%
+ \noexpand\begin\easyfig@env%
+ \ifx\easyfig@placement\@empty\else
+ [\easyfig@placement]%
+ \fi
+ }%
+ \@tempa
+ \easyfig@captionabove{#2}%
+ \edef\@tempa{\noexpand\begin{adjustbox}{\easyfig@expandonce\XKV@rm}}%
+ \@tempa
+ \includegraphics{#2}%
+ \end{adjustbox}%
+ \easyfig@caption{#2}%
+ \expandafter\end\easyfig@env%
+ \endgroup
+}
+\else
+\newcommand{\@Figure}[2][]{%
+ \def\@tempa{\setkeys*{easyfig}}%
+ \expandafter\toks@\expandafter{\easyfig@default,#1}%
+ \expandafter\expandafter\expandafter\toks@
+ \expandafter\expandafter\expandafter{\expandafter\the\expandafter\toks@\expandafter,\easyfig@default@end}%
+ \expandafter\@tempa\expandafter{\the\toks@}
+ \edef\@tempa{\noexpand\begin{\easyfig@env}}%
+ \expandafter\@tempa\easyfig@placement
+ \easyfig@captionabove{#2}%
+ \def\@tempa{\begin{adjustbox}}%
+ \expandafter\def\expandafter\@tempb\expandafter{\expandafter{\XKV@rm}}%
+ \expandafter\@tempa\@tempb
+ \includegraphics{#2}%
+ \end{adjustbox}%
+ \easyfig@caption{#2}%
+ \expandafter\end\easyfig@env%
+ \endgroup
+}
+\fi
+\endinput
+%%
+%% End of file `easyfig.sty'.