LATEX-L Archives

Mailing list for the LaTeX3 project

LATEX-L@LISTSERV.UNI-HEIDELBERG.DE

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Joseph Wright <[log in to unmask]>
Reply To:
Mailing list for the LaTeX3 project <[log in to unmask]>
Date:
Tue, 17 Jul 2012 19:27:20 +0100
Content-Type:
multipart/mixed
Parts/Attachments:
text/plain (2157 bytes) , demo.dtx (2996 bytes)
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
> <http://texdev.net/2009/10/06/a-model-dtx-file/>, 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 %</internal> %<*readme> --------------------------------------------------------------- <pkg> --- <tag line> Maintained by <name> E-mail: <user>@<domain> Released under the LaTeX Project Public License v1.3c or later See http://www.latex-project.org/lppl.txt --------------------------------------------------------------- <Short description> %</readme> %<*internal> \fi \def\nameofplainTeX{plain} \ifx\fmtname\nameofplainTeX\else \expandafter\begingroup \fi %</internal> %<*install> \input l3docstrip.tex \keepsilent \askforoverwritefalse \preamble --------------------------------------------------------------- <pkg> --- <tag line> Maintained by <name> E-mail: <user>@<domain> Released under the LaTeX Project Public License v1.3c or later See http://www.latex-project.org/lppl.txt --------------------------------------------------------------- \endpreamble \postamble Copyright (C) <year> by <name> <<user>@<domain>> 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 <pkg>.dtx and the derived files <pkg>.ins, <pkg>.pdf and <pkg>.sty. \endpostamble \usedir{tex/latex/<pkg>} \generate{ \file{\jobname.sty}{\from{\jobname.dtx}{package}} } %</install> %<install>\endbatchfile %<*internal> \usedir{source/latex/<pkg>} \generate{ \file{\jobname.ins}{\from{\jobname.dtx}{install}} } \nopreamble\nopostamble \usedir{doc/latex/<pkg>} \generate{ \file{README.txt}{\from{\jobname.dtx}{readme}} } \ifx\fmtname\nameofplainTeX \expandafter\endbatchfile \else \expandafter\endgroup \fi %</internal> %<*driver|package> \RequirePackage{expl3,xparse} %</driver|package> %<*driver> \documentclass[full]{l3doc} \usepackage{<pkg>} \begin{document} \DocInput{\jobname.dtx} \end{document} %</driver> % \fi % % \GetFileInfo{\jobname.sty} % % \title{^^A % \pkg{<pkg>} --- <tag line>^^A % \thanks{^^A % This file describes version \fileversion, last revised % \filedate.^^A % }^^A % } % \author{^^A % <name>\thanks{E-mail: <user>@<domain>}^^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} %<@@=<prefix>> % \end{macrocode} % % \begin{macrocode} \ProvidesExplPackage {<pkg>} {<datee} {<version>} {<tag line>} % \end{macrocode} % % \begin{macrocode} %</package> % \end{macrocode} % % \end{implementation} % % \PrintChanges % % \PrintIndex

ATOM RSS1 RSS2