我有几个提供一些基于 TikZ 的图片的包。
最初我使用类文件编写了这些dtxdoc
,但已开始切换到l3doc
文件。当我使用newmacro
环境对图片进行评论时,我现在收到消息,称宏未在包文档中定义。出现该消息的原因是它dtxdoc
不关心您是否定义了宏,而它却l3doc
定义了。实际上这是正确的,因为我在 pgfkey 系统中定义键而不是宏。
因此,我仔细查阅了 TikZ 文档,发现key
环境通常用于记录 TikZ/PGF 密钥,但它似乎不是前言导入的任何包的一部分。有人用过这个或看过这个文档吗?
在这个网站上有一两条关于使用codeexample
环境的评论dtxdoc
,但我没有找到任何关于该key
环境的引用。
% \iffalse meta-comment
%
% Copyright (C) 2016 by Carel <[email protected]>
% ---------------------------------------------------------
%
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either
% version 1.2 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.2 or later is part of all distributions
% of LaTeX version 1999/12/01 or later.
%
% \fi
% \iffalse
%
% ^^A Identification
%
%<*driver>
\ProvidesFile{tikzkit.dtx}
%</driver>
%
% ^^A Package Provides
%
%<Pkg>\NeedsTeXFormat{LaTeX2e}[1994/06/01] % 1994/06/01 - First revision of the LaTeX kernel to support error handling
%<Sty>\ProvidesPackage{tikzkit}
%<*Sty>
[2016/09/15 v0.1 TikZkiT provides complimentary code for TikZ]
%</Sty>
%
% ^^A Package Requires
%
%^^A <STY>\RequirePackage{PACKAGE} % Substitute any required packages
%^^A<Sty>\RequirePackage{menukeys}
%
% ^^A Package Installation
%
%<*batchfile>
\begingroup
%%
%% Copyright (C) 2016 by Carel
%%
%% This file may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.2 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.2 or later is part of all distributions of
%% LaTeX version 1999/12/01 or later.
%%
\input docstrip.tex
\keepsilent
\usedir{tex/latex/TikZkiT}
\preamble
This is a generated file.
Copyright (C) 2016 by Carel
This file may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either
version 1.2 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.2 or later is part of all distributions of
LaTeX version 1999/12/01 or later.
\endpreamble
\askforoverwritefalse % ^^A Always overwrite
%^^A \IfFileExists{<>}{}{...} % ^^A Protect if exists
\generate{\file{TikZkiT/tikzkit.sty}{\from{TikZkiT.dtx}{Pkg,Sty}}}
\generate{\file{TikZkiT/pgflibraryTikZkiT.code.tex}{\from{TikZkiT.dtx}{Pkg,Pgf}}}
\generate{\file{TikZkiT/tikzlibraryTikZkiT.code.tex}{\from{TikZkiT.dtx}{Pkg,TikZ}}}
\generate{\file{TikZkiT/pgflibraryshapes.TikZkiT.code.tex}{\from{TikZkiT.dtx}{Pkg,Pics}}}
\endgroup
%</batchfile>
%
% ^^A Documentation Generation
%
%<*driver>
\documentclass{l3doc}
\usepackage{tikzkit}
\usepackage[version=latest]{pgf}
\usepackage{tikz}
\usepackage{xkeyval,calc,listings,fp}
\usepackage{menukeys}
\usetikzlibrary{TikZkiT}
\newmenumacro{\TeXPath}[/]{hyphenatepathswithfolder}
\newmenumacro{\TeXFile}[/]{hyphenatepaths}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
%^^A \OnlyDescription % User optionally sets this with \AtBeginDocument{} in ltxdoc.cfg do not enforce.
\begin{document}
\DocInput{tikzkit.dtx}
\PrintChanges
\PrintIndex
\end{document}
%</driver>
% \fi
%
% ^^A Boiler Plate
%
% \CheckSum{0} % ^^A Set the number of backslash characters in the document
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
% Digits \0\1\2\3\4\5\6\7\8\9
% Exclamation \! Double quote \" Hash (number) \#
% Dollar \$ Percent \% Ampersand \&
% Acute accent \' Left paren \( Right paren \)
% Asterisk \* Plus \+ Comma \,
% Minus \- Point \. Solidus \/
% Colon \: Semicolon \; Less than \<
% Equals \= Greater than \> Question mark \?
% Commercial at \@ Left bracket \[ Backslash \\
% Right bracket \] Circumflex \^ Underscore \_
% Grave accent \` Left brace \{ Vertical bar \|
% Right brace \} Tilde \~}
%
% ^^A Change log
%
% \changes{v0.0}{2016/09/15}{Initial version}
%
% ^^A Package version information
%
% \GetFileInfo{TikZkiT.dtx}
%
% ^^A Common Commands
%
% \DoNotIndex{\newcommand,\newenvironment,\newcounter,\def,\edef}
% \DoNotIndex{\#,\$,\%,\&,\@,\\,\{,\},\^,\_,\~,\ }
% \DoNotIndex{\@ne}
% \DoNotIndex{\begingroup,\endgroup,\closein,\closeout,\advance,\catcode}
% \DoNotIndex{\if,\else,\fi,\empty}
% \DoNotIndex{\day}
% \DoNotIndex{\arabic}
% \DoNotIndex{\tiny,\small,\large}
% \DoNotIndex{\circ}
% \DoNotIndex{\jobname}
% \DoNotIndex{\tikzset}
%
% ^^A Attribution and Title
%
% \title{The \textsf{TikZkiT} package\thanks{This document
% corresponds to \textsf{TikZkiT}~\fileversion,
% dated~\filedate.}}
% \author{Carel \\ \texttt{[email protected]}}
%
% \maketitle
%
% ^^A Package Abstract
%
% \begin{abstract}
% This package provides various PGF/TikZ features
% \end{abstract}
%
% ^^A Introduction
%
% \section{Introduction}
%
% This package provides a few keys that I have need for on occasion.
% It is an attempt at gathering these keys, scattered in ones pre-ambles, into a single package.
%
% ^^A Installation
%
% \section{Installation}
%
% The following table lists the final installation locations files provided by this package.
%
% \begin{tabbing}
% \hspace{1em}\=\hspace{1em}\=\hspace{1em}\=\hspace{17em}\=\\\kill
% \TeXPath{\TeX MF} \>\>\>\> \TeX\ system's root folder \+\\
% \TeXPath{tex/generic/pgf} \>\>\> PGF/TikZ root folder \+\\
% \TeXPath{frontendlayer/tikz/libraries} \>\> TikZ layer's libraries \+\\
% \TeXFile{tikzlibraryTikZkiT.code} \> TikZkiT library \-\\
% \TeXPath{libraries} \>\> PGF layer's libraries \+\\
% \TeXFile{pgflibraryTikZkiT.code} \> TikZkiT library \-\\
% \TeXPath{libraries/shapes} \>\> shape libraries \+\\
% \TeXFile{pgflibraryshapes.TikZkiT.code} \> TikZkiT shapes \\
% \end{tabbing}
%
% ^^A Usage
%
% \section{Usage}
%
% This is still under development
%
% ^^A Macro Description
%
%^^A \DescribeMacro{\<MACRO>}
%^^A A paragraph describing a |\<MACRO>| it options, arguments and usage.
%^^A An reference to the macro may be placed in the index using \index{<DESCRIPTION>|<CATEGORY>}
%
%^^A \DescribeEnv{<ENVIRONMENT>}
%^^A A paragragrph describing an |<ENVIRONMENT>|, it's options, arguments and usage.
%
% \StopEventually{\PrintChanges \PrintIndex} ^^A Text between here and \Finally is not shown if \OnlyDescription is used.
%
% ^^A Implementation
%
% \section{Implementation}
%
% ^^A Package Implementation
%
% The PGF manual documents the package structure in the section entitled ``The Hierarchial Structure of the package''.
%
% \subsection{TikZ Layer}
%
%\iffalse
%<*TikZ>
%\fi
%
% Initially a name space/scope is setup to accomodate the TikZkiT code.
%
%^^A\begin{key}{/tikz/TikZkiT=\meta{TikZkiT}}
% \begin{macrocode}
\tikzset{
TikZkiT/.is family,
}
% \end{macrocode}
%^^A\end{key}
%
% Although the main purpose of the front end code is to load the appropriate PGF libraries.
%
% \begin{macrocode}
\usepgflibrary{TikZkiT}
% \end{macrocode}
%
%\iffalse
%</TikZ>
%\fi
%
% \subsection{PGF Layer}
%
%\iffalse
%<*Pgf>
%\fi
%
% The library file defines any defaults required for the component libraries it imports.
%
% \begin{macrocode}
\usepgflibrary{shapes.TikZkiT}
% \end{macrocode}
%
%\iffalse
%</Pgf>
%\fi
%
% \subsection{Shapes Library}
%
%\iffalse
%<*Pics>
%\fi
%
% \begin{macro}{\b@sis} \changes{v0.0}{2016/09/15}{Included a common base length for diagrams}
% \begin{macro}{\basis} \changes{v0.0}{2016/09/15}{Included macro for accessing the base length}
% \begin{macrocode}
\newlength{\b@sis}
% \end{macrocode}
% This length is now accessible within user defined macros but we also need to make it available to TikZ.
% \begin{macrocode}
\tikzset{
TikZkiT,
basis/.store in=\b@sis,
basis/.default={1 em},
}
% \end{macrocode}
% \end{macro}
% \end{macro}
%
%\iffalse
%</Pics>
%\fi
%
% ^^A Macro Templates
%
%^^A % \begin{macro}{\<MACRO>}
%^^A % Describe the macro |\<MACRO>| and it's \marg{mandatory}, \oarg{optional} and \parg{picture} arguments along with any \meta{other} information.
%^^A % \changes{v<MAJOR>.<MINOR>}{<YEAR>/<MONTH>/<DATE>}{<MESSAGE>}
%^^A % \begin{macrocode}
%^^A \newcommand{\<MACRO>}[]{}
%^^A % \end{macrocode}
%^^A % \end{macro}
%
%^^A % \begin{environment}{<ENVIRONMENT>}
%^^A % Describe the environment |<ENVIRONMENT>| and it's implementation here.
%^^A % \changes{v<MAJOR>.<MINOR>}{<YEAR>/<MONTH>/<DATE>}{<MESSAGE>}
%^^A % \begin{macrocode}
%^^A \newenvironment{<ENVIRONMENT>}{}{}
%^^A % \end{macrocode}
%^^A % \end{environment}
%
% ^^A Prompt
%
% \Finale
%\typeout{***********************************************************}
%\typeout{* *}
%\typeout{* To finish the installation you have to move the *}
%\typeout{* following file into a directory searched by TeX: *}
%\typeout{* *}
%\typeout{* \space\space TikZkiT.sty *}
%\typeout{* *}
%\typeout{* To produce the documentation run the file TikZkiT.dtx *}
%\typeout{* through LaTeX. *}
%\typeout{* *}
%\typeout{* To product the correct index and glossary you may also *}
%\typeout{* have to run the following two commands *}
%\typeout{* *}
%\typeout{* makeindex -s gglo.ist -o TikZkiT.gls TikZkiT.glo *}
%\typeout{* makeindex -s gind.ist -o TikZkiT.ind TikZkiT.idx *}
%\typeout{* *}
%\typeout{* Happy TeXing! *}
%\typeout{***********************************************************}
\endinput
答案1
经过一番搜索,我找到了一个名为的文件pgfmanual-en-macros.tex
,它提供了key
TikZ/PGF 手册中使用的环境。我复制了一份,并将其放入我编译包的根文件夹中。我将此文件输入到包的序言中,它似乎全部正常工作。如果您想要更新的代码,请给我留言,我会发布它。
从法律上讲,我理解我被允许这样做,因为该文件以一条消息作为前缀,表明它可以在 LPPL 或 GPL 许可下使用。