From 2d42acb5090a08806f0533c9688b548b064b0324 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Tue, 9 May 2017 21:16:40 +0000 Subject: draftfigure (8may17) git-svn-id: svn://tug.org/texlive/trunk@44269 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/draftfigure/README.md | 37 ++ .../doc/latex/draftfigure/draftfigure.pdf | Bin 0 -> 138579 bytes .../doc/latex/draftfigure/draftfigure.tex | 408 +++++++++++++++++++++ .../tex/latex/draftfigure/draftfigure.sty | 128 +++++++ Master/tlpkg/bin/tlpkg-ctan-check | 3 +- Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc | 1 + Master/tlpkg/tlpsrc/draftfigure.tlpsrc | 0 7 files changed, 576 insertions(+), 1 deletion(-) create mode 100644 Master/texmf-dist/doc/latex/draftfigure/README.md create mode 100644 Master/texmf-dist/doc/latex/draftfigure/draftfigure.pdf create mode 100644 Master/texmf-dist/doc/latex/draftfigure/draftfigure.tex create mode 100644 Master/texmf-dist/tex/latex/draftfigure/draftfigure.sty create mode 100644 Master/tlpkg/tlpsrc/draftfigure.tlpsrc (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/draftfigure/README.md b/Master/texmf-dist/doc/latex/draftfigure/README.md new file mode 100644 index 00000000000..a3b9f004c1d --- /dev/null +++ b/Master/texmf-dist/doc/latex/draftfigure/README.md @@ -0,0 +1,37 @@ +draftfigure +======= + +a package to replace figures with a white box and additional features +--- +_2017/05/06 v0.1_ + +Copyright (c) 2017 Lukas C. Bossert + +[info@biblatex-archaeologie.de](mailto:info@biblatex-archaeologie.de) | [www.digitales-altertum.de](http://www.digitales-altertum.de) + +With this package you can control the outcome of a figure which is set to `draft` and modify the display with various options. + +--- + +This package contains: + +documentation: + +- draftfigure.pdf +- draftfigure.tex + +style-file: + +- draftfigure.sty + + +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](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 [Lukas C. Bossert](https://github.com/LukasCBossert). + diff --git a/Master/texmf-dist/doc/latex/draftfigure/draftfigure.pdf b/Master/texmf-dist/doc/latex/draftfigure/draftfigure.pdf new file mode 100644 index 00000000000..ec8c9d2463b Binary files /dev/null and b/Master/texmf-dist/doc/latex/draftfigure/draftfigure.pdf differ diff --git a/Master/texmf-dist/doc/latex/draftfigure/draftfigure.tex b/Master/texmf-dist/doc/latex/draftfigure/draftfigure.tex new file mode 100644 index 00000000000..2e03fdea96e --- /dev/null +++ b/Master/texmf-dist/doc/latex/draftfigure/draftfigure.tex @@ -0,0 +1,408 @@ +% \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-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 plase let me know: \href{mailto:lukas@digitales-altertum.de}{lukas@digitales-altertum.de} + +\section{Changelog} +\PrintRevisions + +\end{document} \ No newline at end of file diff --git a/Master/texmf-dist/tex/latex/draftfigure/draftfigure.sty b/Master/texmf-dist/tex/latex/draftfigure/draftfigure.sty new file mode 100644 index 00000000000..71d189e27df --- /dev/null +++ b/Master/texmf-dist/tex/latex/draftfigure/draftfigure.sty @@ -0,0 +1,128 @@ +% 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. + \def\df@date{2017/05/06} + \def\df@version{0.1} + \def\df@styid{\df@date\space v\df@version\space draftfigure (LCB)} + \let\dfdate\df@date + \let\dfversion\df@version + +\NeedsTeXFormat{LaTeX2e}[1994/06/01] +\ProvidesPackage{draftfigure}[\df@styid] + +\RequirePackage{graphicx} +\RequirePackage{etoolbox} +\RequirePackage{xkeyval} +\RequirePackage{calc} + +\newbool{df@filename} +\newbool{df@content} +\newbool{df@noframe} + +\newlength\df@height +\newlength\df@length + +\providecommand*\df@size{} +\providecommand*\df@style{} +\providecommand*\df@font{} +\providecommand*\df@position{} +\providecommand*\df@content{} + + +\patchcmd{\Gin@setfile}{\expandafter\strip@prefix\meaning\@tempa}{\@draftfigure}{}{} + + +\providecommand\df@noframe{% NOT WORKING + \patchcmd\Gin@setfile{\vrule\hss}{\vrule\@width\z@\hss}{}{}%left + \patchcmd\Gin@setfile{\hss\vrule}{\hss\vrule\@width\z@}{}{}%right + \patchcmd\Gin@setfile{\hrule\@width}{\hrule\@height\z@\@width}{}{}%top + \patchcmd\Gin@setfile{\vss\hrule}{\vss\hrule\@height\z@}{}{}%bottom +} + +%% Declare a package option +\DeclareOptionX{content}{\def\df@content{#1}} +\DeclareOptionX{filename}[true]{\csuse{bool#1}{df@filename} + +} +\DeclareOptionX{size}[small]{\def\df@size{\csname df@size@#1\endcsname}} +\DeclareOptionX{style}[sf]{\def\df@style{\csname df@style@#1\endcsname}} +\DeclareOptionX{position}[right]{\def\df@position{\csname df@position@#1\endcsname}} +\DeclareOptionX{allfiguresdraft}[true]{\setkeys{Gin}{draft=#1}} +\DeclareOptionX{noframe}[true]{\csuse{bool#1}{df@noframe}\df@noframe + \patchcmd\Gin@setfile{\vrule\hss}{\vrule\@width\z@\hss}{}{}%left + \patchcmd\Gin@setfile{\hss\vrule}{\hss\vrule\@width\z@}{}{}%right + \patchcmd\Gin@setfile{\hrule\@width}{\hrule\@height\z@\@width}{}{}%top + \patchcmd\Gin@setfile{\vss\hrule}{\vss\hrule\@height\z@}{}{}%bottom +} + +%% predefined styles +\providecommand\df@style@normal{\normalfont} +\providecommand\df@style@sf{\sffamily} +\providecommand\df@style@sc{\scshape} +\providecommand\df@style@bf{\bfseries} +\providecommand\df@style@it{\itshape} +\providecommand\df@style@tt{\ttfamily} +\providecommand\df@style@rm{\rmfamily} + +\providecommand\df@size@tiny{\tiny} +\providecommand\df@size@scriptsize{\scriptsize} +\providecommand\df@size@small{\small} +\providecommand\df@size@footnotesize{\footnotesize} +\providecommand\df@size@normal{\normalsize} +\providecommand\df@size@large{\large} +\providecommand\df@size@Large{\Large} +\providecommand\df@size@Large{\LARGE} +\providecommand\df@size@huge{\huge} + +\providecommand\df@position@top{}%% fix me +\providecommand\df@position@center{\centering} +\providecommand\df@position@bottom{}%% fix me +\providecommand\df@position@right{\raggedleft} +\providecommand\df@position@left{\raggedright} + +%% Process the options given to the package +\ProcessOptionsX + +\define@key{draftfigure}{code}{% + \def\df@style{#1}} +\define@key{draftfigure}{noframe}[true]{% + \csuse{bool#1}{df@noframe} + \df@noframe} +\define@key{draftfigure}{filename}[true]{% + \csuse{bool#1}{df@filename}} +\define@key{draftfigure}{content}[]{% + \def\df@content{#1}} +\define@key{draftfigure}{style}[normal]{% + \def\df@style{\csname df@style@#1\endcsname}} +\define@key{draftfigure}{position}[left]{% + \def\df@position{\csname df@position@#1\endcsname}} +\define@key{draftfigure}{size}[normal]{% + \def\df@size{\csname df@size@#1\endcsname}} + +\newcommand\setdf[1]{\setkeys{draftfigure}{#1}} + +\def\@draftfigure{% +\setlength\df@height{\Gin@nat@height}% +\setlength\df@length{\Gin@req@width}% +\begin{minipage}[c][\df@height-5pt][c]{\df@length-5pt}% + \sffamily% + \df@position% + \df@size% + \df@style% + \df@content% + \ifbool{df@filename}{% + \ifdef{\df@content}% + {\mbox{~}\\[\baselineskip]}% + {}% + \expandafter\strip@prefix\meaning\@tempa}% + {}% +\end{minipage}}% +\endinput diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index 594f13f4840..cfad5cb861d 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -215,7 +215,8 @@ my @TLP_working = qw( docmfp docmute docsurvey doctools documentation doi doipubmed dosepsbin dot2texi dotarrow dotseqn dottex - doublestroke dowith download dox dozenal dpfloat dprogress drac draftcopy + doublestroke dowith download dox dozenal dpfloat dprogress + drac draftcopy draftfigure draftwatermark dramatist dratex drawmatrix drawstack drm droid droit-fr drs drv dsptricks dtk dtxdescribe dtxgallery dtxgen diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc index 009ab2f4f54..da0c0fb3e8f 100644 --- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc @@ -294,6 +294,7 @@ depend dpfloat depend dprogress depend drac depend draftcopy +depend draftfigure depend draftwatermark depend dtk depend dtxdescribe diff --git a/Master/tlpkg/tlpsrc/draftfigure.tlpsrc b/Master/tlpkg/tlpsrc/draftfigure.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d -- cgit v1.2.3