## LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

#### View:

 Message: [ First | Previous | Next | Last ] By Topic: [ First | Previous | Next | Last ] By Author: [ First | Previous | Next | Last ] Font: Proportional Font

Subject:

Re: model l3 dtx file

From:

Date:

Tue, 17 Jul 2012 19:27:20 +0100

Content-Type:

multipart/mixed

Parts/Attachments:

 text/plain (51 lines) , demo.dtx (1 lines)
 On 17/07/2012 18:38, Joel C. Salomon wrote: > I've been playing with some expl3 code on TeX.SX, and I'm trying to > turn some of that code into a package. Since I'm using expl3, I > figured I'd also experiment with l3doc. (Yes, I know it's labeled > "experimental"; I want to experiment.) > > I started with Joseph Wright's model dtx file from > , but I'm having some > trouble adapting it to l3doc. Does anyone have some boilerplate code I > can build off of? > > I'm reading expl3 documentation code, but that's rather large. Also, > there seems to be some magic involved with code like > \ProvidesExplClass > {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} > that I'm unable to figure out. > > BTW, should I also be using l3docstrip? > > —Joel There are a few approaches to building a .dtx file, as you can see if you look at the selection on CTAN. You will find 'traditional' .dtx files, which need an .ins file to be extracted, and 'all-in-one' .dtx files, which include their own .ins internally. My model .dtx file is of the latter type. In the case of the team's .dtx files which form the core of LaTeX3, there are other considerations. Version information is included from the SVN Id stings, which are picked up by \GetIdInfo and then turned into \ExplFileName, etc. At the same time, the files have to be set up to extract both in LaTeX2e package and IniTeX 'format' mode, and have somewhat complex load-order requirements. They also need to build into a single PDF file. This makes them less than ideal as a model for most packages. I've attached a template for creating a 'self extracting' .dtx file using l3doc, based on the approach I use in notes2bib and siunitx. I've kept only the basics, and removed some code I use for including demos: look at "LaTeXdemo" in my .dtx files to see this. In the demo, I've stuck with hard-coding in the version, so the \ProvidesExplClass is less complex than the one you've mentioned. Although this does not pick up data directly from commits to a version control system, I think it works better over all. (Certainly if you use Git or Mercurial.) -- Joseph Wright % \iffalse meta-comment %<*internal> \iffalse % %<*readme> --------------------------------------------------------------- --- Maintained by E-mail: @ Released under the LaTeX Project Public License v1.3c or later See http://www.latex-project.org/lppl.txt --------------------------------------------------------------- % %<*internal> \fi \def\nameofplainTeX{plain} \ifx\fmtname\nameofplainTeX\else \expandafter\begingroup \fi % %<*install> \input l3docstrip.tex \keepsilent \askforoverwritefalse \preamble --------------------------------------------------------------- --- Maintained by E-mail: @ Released under the LaTeX Project Public License v1.3c or later See http://www.latex-project.org/lppl.txt --------------------------------------------------------------- \endpreamble \postamble Copyright (C) by <@> It may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of this license or (at your option) any later version. The latest version of this license is in the file: http://www.latex-project.org/lppl.txt This work is "maintained" (as per LPPL maintenance status) by Joseph Wright. This work consists of the file .dtx and the derived files .ins, .pdf and .sty. \endpostamble \usedir{tex/latex/} \generate{ \file{\jobname.sty}{\from{\jobname.dtx}{package}} } % %\endbatchfile %<*internal> \usedir{source/latex/} \generate{ \file{\jobname.ins}{\from{\jobname.dtx}{install}} } \nopreamble\nopostamble \usedir{doc/latex/} \generate{ \file{README.txt}{\from{\jobname.dtx}{readme}} } \ifx\fmtname\nameofplainTeX \expandafter\endbatchfile \else \expandafter\endgroup \fi % %<*driver|package> \RequirePackage{expl3,xparse} % %<*driver> \documentclass[full]{l3doc} \usepackage{} \begin{document} \DocInput{\jobname.dtx} \end{document} % % \fi % % \GetFileInfo{\jobname.sty} % % \title{^^A % \pkg{} --- ^^A % \thanks{^^A % This file describes version \fileversion, last revised % \filedate.^^A % }^^A % } % \author{^^A % \thanks{E-mail: @}^^A % } % \date{Released \filedate} % % \maketitle % % \begin{abstract} % \end{abstract} % % \tableofcontents % % \begin{documentation} % % \end{documentation} % % \begin{implementation} % % \section{Implementation} % % \begin{macrocode} %<*package> % \end{macrocode} % % \begin{macrocode} %<@@=> % \end{macrocode} % % \begin{macrocode} \ProvidesExplPackage {} {} {} % \end{macrocode} % % \begin{macrocode} % % \end{macrocode} % % \end{implementation} % % \PrintChanges % % \PrintIndex