Tag Info

14

You can probably go texdoc docstrip to get the documentation for it or there is a copy here http://www.tug.org/texlive/Contents/live/texmf-dist/doc/latex/base/docstrip.pdf It is a set of tex macros distributed as part of the core LaTeX which produces packages and class files .sty and .dtx by removing comments from documented versions (usually .dtx files. It ...

14

DocStrip is primarily method for removing comments from source files. While not such a big issue today, historically it was desirable to convert % Some comment about code % More comments about code \CodeIsHere % Followed by more description to just \CodeIsHere as TeX has fewer lines to process and so will read a file more quickly. DocStrip is able to ...

9

A 'classical' (~LaTeX2.09) .dtx file contained the source and documentation for (usually) a LaTeX package, but not the instructions to extract the package from the source or to typeset the documentation. As such, latex foo.dtx would not result in useful output. To allow extracting, an installation (.ins) file was needed, and to allow typesetting a driver ...

9

In the original plan of docstrip the documented source would be in the .dtx file and a separate LaTeX "driver" document, which could be .tex except that might clash with files that are being generated, would be used to input the doc package and produce the documentation, and a third .ins file would be used with docstrip to control the generation of the ...

9

If you look at the history of doc, then it is understandable why the current system works as it works. Initially the idea as to write a .sty file with the comments imbedded, but in a way that it would directly be processable by LaTeX. And that required putting every bit of documentation behind % signs. Only later docstrip appeared (to strip the comments ...

8

This is not really related to dtx but rather the usual "don't define conditionals in a conditional block" issue: % \ifcode % some code explanations % \begin{macrocode} \newif\ifcadre \cadretrue \renewcommand{\maketitle} { \ifcadre \framebox{title} \else if \ifcode is false then \begin{macrocode} is not executed so the block is not read ...

7

The l3docstrip package is an extension of the standard DocStrip bundle, and adds on one very specific feature: replacing @@ by a module prefix. For the 'user' (in this case the package author), the use of l3docstrip is intended to mirror closely that for DocStrip. Thus in place of \input docstrip.tex in the demonstration DTX file, all that should be ...

7

If ^ has its usual superscript meaning then ^^A is built-in primitive TeX syntax for the non-printing character control A (that is U+0001) 64 less than A. This is just an arbitrary character that Frank chose as being unlikely to be used elsewhere. The important thing about it in this context is that doc.sty does \catcode\^^A=14 ...

6

If I paste the line % ￼\GetFileInfo{attempt.sty} in the http://rishida.net/tools/conversion/ input box, I get, in the Unicode U+hex box % U+FFFC\GetFileInfo{attempt.sty} So it's a spurious character that produces the problem. It appears as three bytes if Unicode is disabled; here's what less shows: % ...

5

you can use \generate{\nopreamble\nopostamble .... To stop docstrip adding anything to the file but the character table and \CheckSum is not generated text it is just copied from the source dtx file as literal %% comments. So if you don't put it in the source it won't be in the result. Or if you want it in some files but not others, use docstrip guards ...

5

In .dtx files the sequence ^^A replaces the standard % to introduce comments. .dtx files are usually processed through doc and docstrip which don't consider % a comment. In fact, when you run latex (or pdflatex) on a such structured .dtx file, it is actually evaluated twice. The first time, only a small piece of driver code is evaluated. The second time, ...

4

Unpacking As far as I see the source is myclass.dtx Optionally a docstrip installation file can be provided: myclass.ins In my packages the .ins file is embedded in the .dtx file anyway and I added an engine switch in myclass.dtx: If plain TeX is used, then the installation driver (myclass.ins) is triggered and the files unpacked. LaTeX on the other ...

4

This is not a DocStrip limitation: it's a TeX one. TeX will always add .tex if there is no extension. For example, try \newwrite\mywrite \immediate\openout\mywrite foo % \bye (You can do \immediate\openout\mywrite foo. %, but the file ends up called foo. not just foo.) The normal approach to this is to use a script for building for CTAN, which has the ...

2

TeX Live sets up his options in the file texmf.cnf located in texlive/20XX/texmf/web2c/ However this file needn't to be edit. You should edit instead the file texmf.cnf in the directory texlive/20XX/. In the main file you will find the following hint: % Allow TeX \openin, \openout, or \input on filenames starting with .' % (e.g., .rhosts) or outside the ...

2

David's answer is enlightning. With that explanation a workaround is very easy to set up. Using the verbatim package (and its very nicely coded comment environment) it is easy to define a code environment differently when \ifcode is true or false. When it's true it does nothing (or almost) when it's false it skips every lines inside it. Here is the code: ...

1

Ok, so maybe it's not possible to do this elegantly using the 'standard' way of running the .dtx file through LaTeX to get the docs. But I have an alternative solution here which seems just as nice. With this setup, there is only one file (the '.ins file' is included). You run it through LaTeX and it generates package.sty and package.tex. To get the actual ...

1

Here is the skeleton of the dtx of a package I have written and which will appear in a few days on CTAN (the current version on CTAN does not yet have this structure of the dtx file) %<*none> % This skeleton PKG.dtx file is one way to not have everything commented % out in the documentation part. It produces the .sty file (and also an % .ins file) ...

1

AFAIK, most package documentation actuall has one section consisting of user interface documentation (options, user-level commands) and one section containing the implementation details of the package (with useful comments, documented side effects of internal macros, and so on). The documentation of e.g. amstext, fixmath or microtype illustrate this. Larger ...

Only top voted, non community-wiki answers of a minimum length are eligible