1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409
|
% \draftfigure --%
% modifying drafted figures
% Copyright (c) 2017 Lukas C. Bossert
%
% 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.
% !TEX program = lualatex
\documentclass[a4paper,
10pt,
english
]{ltxdoc}
\input{draftfigure-preamble.tex}
\newcommand\df{draftfigure\xspace}
\newcommand\dfstring{|draftfigure|\xspace}
\setkeys{Gin}{width=.5\linewidth}
\begin{document}
\AddRevision{2017-07-19}{Improvement of coding}{Lukas C. Bossert}
\AddRevision{2017-05-07}{Documentation completed}{Lukas C. Bossert}
\AddRevision{2017-05-06}{Initial release}{Lukas C. Bossert}
\title{\texttt{\df} -- \\ modifying drafted figures\footnote{%
For further information about the code visit \href{https://github.com/LukasCBossert/draftfigure}{https://github.com/LukasCBossert/draftfigure}
Comments and criticisms are welcome.}}
\author{Lukas C. Bossert\\{\small \href{mailto:lukas@digitales-altertum.de}{lukas@digitales-altertum.de}}}
\date{Version: \dfdate{} (\dfversion)}
\maketitle
\begin{abstract}
\noindent This package allows you to customize the outcome of drafted figures.
\end{abstract}
\begin{multicols}{2}
\footnotesize\parskip=0mm \tableofcontents
\end{multicols}
\section{Installation}
\dfstring is part of the distributions MiK\TeX \footnote{Website: \url{http://www.miktex.org}.}
and \TeX Live\footnote{Website: \url{http://www.tug.org/texlive}.}~-- thus, you
can easily install it using the respective package manager.
If you would like to
install \dfstring manually, do the following:
Download the folder \dfstring with all relevant files from the CTAN-server\footnote{\url{https://www.ctan.org/pkg/\df}} and copy the content of the |zip|-file to the \texttt{\$LOCALTEXMF} directory of
your system.\footnote{If you don't know what that is, have a look at
\url{http://www.tex.ac.uk/cgi-bin/texfaq2html?label=tds} or
\url{http://mirror.ctan.org/tds/tds.html}.}
Refresh your filename database.
Here is some additional information from the UK \TeX\ FAQ:
\begin{itemize}[nosep,after=\vspace{-\baselineskip} ]
\item \href{%
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=install-where}{%
Where to install packages}
\item \href{%
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=inst-wlcf}{%
Installing files \enquote{where \LaTeX /TeX\ can find them}}
\item \href{%
http://www.tex.ac.uk/cgi-bin/texfaq2html?label=privinst}{%
\enquote{Private} installations of files}
\end{itemize}
%%introduction from biblatex-dw copied and applied. might to be rewritten.
\clearpage
\section{Status Quo}
Usually you see all of your images in your PDF:
\begin{examplebox}
\begin{figure}[H]
\centering
\includegraphics{example-image-a}
\caption{A}
\includegraphics{example-image-b}
\caption{B}
\includegraphics{example-image-c}
\caption{C}
\end{figure}
\end{examplebox}
Sometimes you do not need to see the images or want to omit them due to faster compiling or you do not have the right to publish them.
You can \enquote{switch off} the images by using the option |draft| either with
|\documentclass[draft]|\marg{class}
%\cs{documentclass}\oarg{draft}\marg{clss}
or with
|\usepackage[draft]{graphicx}|.
%\cs{usepackage}\oarg{draft}\marg{graphicx}
If you do not like the outcome with the filename and its path written with |\ttfamily| but still need the same size of the image in the text then use this package \dfstring to modify the outcome.
\clearpage
\section{Usage}
\DescribeMacro{draftfigure} The name of the package is \dfstring which has to be activated in the preamble.
\begin{code}
\usepackage[*@\meta{further options}@*]{draftfigure}
\end{code}
Without any further options you will now get white boxes instead of the images.
\begin{examplebox}
\begin{figure}[H]\setkeys{Gin}{draft=true}
\centering
\includegraphics{example-image-a}
\caption{A}
\includegraphics{example-image-b}
\caption{B}
\includegraphics{example-image-c}
\caption{C}
\end{figure}
\end{examplebox}
\clearpage
\section{Options}
If you like the plain white boxes you don’t need to do anything else. But if you like to change that use one or more of the following options.
So let’s see some action.
\subsection{Preamble}
The following options are set in the preamble and considered globally for all figures.
\subsubsection{content}
\DescribeMacro{content}
With this option you can set an individual text which will be displayed in the white box.
\begin{code}
\usepackage[%
content = {This figure is omitted due to missing copyrights.},%
]{draftfigure}
\end{code}
\begin{examplebox}
\begin{figure}[H]
\setkeys{draftfigure}{content = {This figure is omitted due to missing copyrights.}}
\setkeys{Gin}{draft=true}
\centering
\includegraphics{example-image-a}
\caption{A}
\includegraphics{example-image-b}
\caption{B}
\end{figure}
\end{examplebox}
\clearpage
\subsubsection{filename}
\DescribeMacro{filename}
Activating this option with |true| the filename will be displayed in the white box.
If you also have defined some text for |content| the filename will appear one line below of |content|.
\begin{code}
\usepackage[%
filename,%
]{draftfigure}
\end{code}
\begin{examplebox}
\begin{figure}[H]
\setkeys{Gin}{draft=true}
\setkeys{draftfigure}{filename}
\centering
\includegraphics{example-image-a}
\caption{A}
\includegraphics{example-image-b}
\caption{B}
\includegraphics{example-image-c}
\caption{C}
\end{figure}
\end{examplebox}
\clearpage
\DescribeMacro{filename}
\DescribeMacro{content}
And with some text in |content| it will look like this:
\begin{code}
\usepackage[%
filename,%
content={no image available}
]{draftfigure}
\end{code}
\begin{examplebox}
\begin{figure}[H]
\setkeys{Gin}{draft=true}
\setkeys{draftfigure}{filename,
content={no image available}}
\centering
\includegraphics{example-image-a}
\caption{A}
\includegraphics{example-image-b}
\caption{B}
\includegraphics{example-image-c}
\caption{C}
\end{figure}
\end{examplebox}
\clearpage
\subsubsection{style}
\DescribeMacro{style} This defines the font style of the text of |content| or |filename|.
You can chose one of the following styles:
\begin{multicols}{3}
\begin{itemize}
\item[sf] |\sffamily|
\item[tt] |\ttfamily|
\item[rm] |\rmfamily|
\item[normal] |\normalfont|
\item[bf] |\bfseries|
\item[it] |\itshape|
\item[sc] |\scshape|
\end{itemize}
\end{multicols}
Default is |sf|.
\DescribeMacro{content}
\DescribeMacro{style}
\begin{code}
\usepackage[%
content={hidden image},
style = {bf},%
]{draftfigure}
\end{code}
\begin{examplebox}
\begin{figure}[H]
\setkeys{Gin}{draft=true}
\setkeys{draftfigure}{style={bf},content={hidden image}}
\centering
\includegraphics{example-image-a}
\caption{A}
\includegraphics{example-image-b}
\caption{B}
% \includegraphics{example-image-c}
% \caption{C}
\end{figure}
\end{examplebox}
\clearpage
\subsubsection{size}
\DescribeMacro{size}
You can also define the text size of |content| with predefined values:
\begin{multicols}{2}
\begin{itemize}
\item[tiny] |\tiny|
\item[scriptsize] |\scriptsize|
\item[small] |\small|
\item[footnotesize] |\footnotesize|
\item[normal] |\normalsize|
\item[large] |\large|
\item[Large] |\Large|
\item[LARGE] |\LARGE|
\item[huge] |\huge|
\end{itemize}
\end{multicols}
Default is |small|.
\DescribeMacro{content}
\DescribeMacro{size}
\begin{code}
\usepackage[%
content={text instead of an image},
size = {huge},%
]{draftfigure}
\end{code}
\begin{examplebox}
\begin{figure}[H]
\setkeys{Gin}{draft=true, width =.6\linewidth}
\setkeys{draftfigure}{
content={text instead of an image},
size = {huge},%
}
\centering
\includegraphics{example-image-a}
\caption{A}
\includegraphics{example-image-b}
\caption{B}
% \includegraphics{example-image-c}
% \caption{C}
\end{figure}
\end{examplebox}
\clearpage
\subsubsection{position}
\DescribeMacro{position}
You can also decide where your text from |content| has to be placed
\begin{multicols}{3}
\begin{itemize}
\item[left] |\raggedright|
\item[center] |\centering|
\item[right] |\raggedleft|
\end{itemize}
\end{multicols}
Default is |left|.
\DescribeMacro{content}
\DescribeMacro{position}
\begin{code}
\usepackage[%
content={positioning},
position = {center},%
]{draftfigure}
\end{code}
\begin{examplebox}
\begin{figure}[H]
\setkeys{Gin}{draft=true,width=.45\linewidth}
\setkeys{draftfigure}{
content={positioning},
position = {center},%
}
\centering
\includegraphics{example-image-a}
\caption{A}
\includegraphics{example-image-b}
\caption{B}
\includegraphics{example-image-c}
\caption{C}
\end{figure}
\end{examplebox}
\clearpage
\subsubsection{allfiguresdraft}
\DescribeMacro{allfiguresdraft}
Enabling |allfiguresdraft| all figures in your text will be shown as a white box. This is the same as |\usepackage[draft]{graphicx}|.
\subsubsection{noframe}
\DescribeMacro{noframe}
The white boxes of the replaced figures are shown with no frame and no border, but still same sizes as the figure it represents.
\subsection{Individually possible options}
Since you can also set |draft| to individual images you can also pass some of the options of \dfstring to individual images.
\DescribeMacro{style}
\DescribeMacro{size}
\DescribeMacro{position}
\DescribeMacro{content}
\DescribeMacro{filename}These are |style|, |size|, |position|, |content|, |filename|.
In the preamble there is this setup
\begin{code}
\usepackage{draftfigure}
\end{code}
So no options are enabled globally.
To pass an option to an image you need to insert in the |figure|-environment the following:
\begin{code}
\setkeys{draftfigure}*@\marg{options}@*
\end{code}
or -- a little bit shorter:
\begin{code}
\setdf*@\marg{options}@*
\end{code}
The overview starts on the next page.
\clearpage
\setkeys{Gin}{width=.4\linewidth}
\begin{codeexample}
\begin{figure}[H]
\centering
\setkeys{draftfigure}{content={white box}}
\includegraphics[draft]{example-image-a}
\caption{A}\label{A}
\setkeys{draftfigure}{filename=true}
\includegraphics[draft]{example-image-b}
\caption{B}\label{B}
\setkeys{draftfigure}{content={another white box}}
\includegraphics[draft]{example-image-c}
\caption{C}\label{C}
\end{figure}
\end{codeexample}
You probably noticed that I defined some text within |content| for \cref{A}.
This text is also shown for \cref{B} although I didn’t define it again --
the options you define with |\setkeys{draftfigure}|\marg{options}
are valid (in an environment) until they are refined
as this happens for \cref{C}.
The same effect you see with the option |filename| which is enabled for \cref{B} and still valid for \cref{C}.
On the next page I show how to deactivate certain options.
\clearpage
\begin{codeexample}
\begin{figure}[H]
\centering
\setkeys{draftfigure}{content={white box}}
\includegraphics[draft]{example-image-a}
\caption{A}\label{A1}
\setkeys{draftfigure}{filename=true,
style={tt},position={right}}
\includegraphics[draft]{example-image-b}
\caption{B}\label{B1}
\setkeys{draftfigure}{content={hidden image},
style={rm},filename=false,position={center}}
\includegraphics[draft]{example-image-c}
\caption{C}\label{C1}
\end{figure}
\end{codeexample}
%Now you can see that for \cref{C1} I set |filename=false| so it isn’t shown in the white box.
\clearpage
\section{Things to work on}
There are still things which work not satisfactually:
\begin{itemize}
\item noframe for individual image
\item combine different styles: sc and sf etc.
\item color frame
\item image instead of text in background
\end{itemize}
If anyone has some ideas please let me know: \href{mailto:lukas@digitales-altertum.de}{lukas@digitales-altertum.de}
\section{Changelog}
\PrintRevisions
\end{document}
|