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