summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/figsize/figsize.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/figsize/figsize.sty
Initial commit
Diffstat (limited to 'macros/latex/contrib/figsize/figsize.sty')
-rw-r--r--macros/latex/contrib/figsize/figsize.sty61
1 files changed, 61 insertions, 0 deletions
diff --git a/macros/latex/contrib/figsize/figsize.sty b/macros/latex/contrib/figsize/figsize.sty
new file mode 100644
index 0000000000..ac4d7475d9
--- /dev/null
+++ b/macros/latex/contrib/figsize/figsize.sty
@@ -0,0 +1,61 @@
+%% FIGSIZE
+%% Package to dynamically size figures relative to the page
+%% size.
+%%
+%% USER COMMANDS
+%% \usepackage{figsize}
+%% If option distort is present then the included images will
+%% be allowed to have different x & y scaling. Otherwise
+%% the aspect ratio will be kept.
+%%
+%% \SetFigLayout[extra lines of space to add]{rows}{cols}
+%% To set the sizes of graphics relative to the page size in a
+%% cell of a matrix with rows and cols specified. Optional
+%% integers can be specified to increase the space allowed for
+%% captions. If a value of 8 is placed, then 8 extra lines of
+%% caption text will be allowed for.
+%%
+%% \includegraphics{file}
+%% To include the graphics with the current most size settings.
+%%
+%%
+%% Anthony Tanbakuchi
+%% Mar.18.2002
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{figsize}[2002/03/18 v0.1 FigSize sizes graphics for graphicx package]
+\RequirePackage{calc}[1998/07/07]
+
+%\RequirePackage[tight]{subfigure}[2002/01/01]
+\RequirePackage{subfigure}
+
+
+\RequirePackage{graphicx}[1999/01/01]
+\RequirePackage{ifthen}[1994/06/01]
+
+ %The new includegraphics command to automatically size figure
+ \let\Oldincludegraphics\includegraphics
+ \renewcommand{\includegraphics}[2][width=\figwidth, totalheight=\figheight, keepaspectratio]{\Oldincludegraphics[#1]{#2}}
+
+
+
+\newlength{\figwidth}
+\newlength{\figheight}
+
+
+\newcommand{\SetFigLayout}[3][0]{\setlength{\figheight}{\textheight}%
+%\addtolength{\figheight}{-0.1\textheight}% 10% for the bottom caption
+%\addtolength{\figheight}{-1.4cm}% for caption text 1 line
+\addtolength{\figheight}{-\baselineskip-\parskip}% for caption text 1 line
+\addtolength{\figheight}{-\abovecaptionskip}%
+\addtolength{\figheight}{-\belowcaptionskip}%
+\setlength{\figheight}{\figheight / #2}%
+\addtolength{\figheight}{(-\baselineskip-\parskip) * (#2-1)}% for subcaption 1 line
+\addtolength{\figheight}{-\baselineskip * #1}% %For additional optional spacing
+%
+\setlength{\figwidth}{\textwidth}%
+\ifthenelse{#3 > 1}{\addtolength{\figwidth}{-0.05\textwidth}}{}% 5% space if multiple cols
+\setlength{\figwidth}{\figwidth / #3}%
+}
+
+\endinput