Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I use Joseph Wright's model dtx file. Unfortunately, when using it, the generated README.txt file contains parts of the package code, which is of course unwanted.

The rather long minimal example is appended at the end. The important part regarding my question is quite on the top, where only "Text" should end up in the README.txt to my understanding:

%<*readme>
Text
%</readme>

Instead, the README.txt looks like

Text
\endbatchfile
\def\shouldNotBeInReadme{really}

Why is that? What did I do wrong?

% \iffalse meta-comment
%<*internal>
\iffalse
%</internal>
%<*readme>
Text
%</readme>
%<readme>\endbatchfile
%<*internal>
\fi
\def\nameofplainTeX{plain}
\ifx\fmtname\nameofplainTeX\else
\expandafter\begingroup
\fi
%</internal>
%<*install>
\input docstrip.tex
\keepsilent
\askforoverwritefalse
\preamble
Preamble
\endpreamble
\postamble
Postamble
\endpostamble
\usedir{tex/latex/tikzscale}
\generate{
\file{\jobname.sty}{\from{\jobname.dtx}{package}}
}
%</install>
%<install>\endbatchfile
%<*internal>
\usedir{source/latex/tikzscale}
\generate{
\file{\jobname.ins}{\from{\jobname.dtx}{install}}
}
\nopreamble\nopostamble
\usedir{doc/latex/tikzscale}
\generate{
\file{README.txt}{\from{\jobname.dtx}{readme}}
}
\ifx\fmtname\nameofplainTeX
\expandafter\endbatchfile
\else
\expandafter\endgroup
\fi
%</internal>
%<*package>
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{tikzscale}[2012/09/10 v0.1 tikzscale LaTeX package]
%</package>
%<*driver>
\documentclass{ltxdoc}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
\begin{document}
\DocInput{\jobname.dtx}
\end{document}
%</driver>
% \fi
%
%\GetFileInfo{\jobname.sty}
%
%\title{Title}
%\author{Author}
%\date{Released \filedate}
%
%\maketitle
%
%\changes{v0.1}{2012/09/10}{First public release}
%
% Text
\def\shouldNotBeInReadme{really}
%
%
%\StopEventually{^^A
%  \PrintChanges
%^^A  \PrintIndex
%}
%
%\Finale
share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

You have an 'unguarded' code line. If you have a line in the .dtx which does not start % and is 'outside' of the guards, it appears in every extracted file. You can see that if you look in the .sty or .ins files. So you want

%    \begin{macrocode}
%<*package>
\def\shouldNotBeInReadme{really}
%</package>
%    \end{macrocode}

or

% \iffalse
%<*package>
% \fi
%    \begin{macrocode}
\def\shouldNotBeInReadme{really}
%    \end{macrocode}
% \iffalse
%</package>
% \fi

or similar.

Not linked to the issue, but the line

%<readme>\endbatchfile

is also spurious.

share|improve this answer
    
if you're thinking of distributing via ctan, please note that ctan needs README, not README.txt -- renaming it slows us down, so please try to remember that the .txt bit is a mistake. (my apologies if you weren't intending that the package be submitted to ctan.) –  wasteofspace Sep 11 '12 at 9:42
    
@wasteofspace It's not possible to get DocStrip to create a file with no extension: TeX will not do this. So the best that can be done in the .dtx is to use a sensible extension. (In the build scripts I've also discussed on my blog, I think I've mentioned something similar and include a rename part.) –  Joseph Wright Sep 11 '12 at 10:15
    
@JosephWright Thanks for the great answer, for the additional information and for the original code. I added a hardlink to README.txt with name README. The latter one is now used in my ctanify script. That might be a good compromise, given the constraints you mentioned here and on your blog. –  Patrick Häcker Sep 11 '12 at 20:19
    
@wasteofspace Thanks a lot for mentioning, I'd had overseen this issue otherwise, as the plan is to distribute this package via ctan one day. –  Patrick Häcker Sep 11 '12 at 20:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.