Latex documents often come with a number of different files. What does a .dtx file usually specify? Please assume that the person reading your answer has next to no experience with using LaTeX. I don't care about the syntax used inside of a .dtx, or how to write a .dtx, I just want a short explanation of what it does.

As an example, inside of a .dtx file put out by the association of computing machinery, I found the following:

% \begin{macro}{\if@ACM@screen}
%   Whether we use screen mode
%    \begin{macrocode}
    \PackageInfo{\@classname}{Using screen mode}%
    \PackageInfo{\@classname}{Not using screen mode}%
  \fi}{\PackageError{\@classname}{The option screen can be either true or
%    \end{macrocode}
% \end{macro}

Originally I said that a .dtx was a "configuration file," and then asked what a .dtx did. However, others have informed me that a .dtx is not a "configuration file." I have subsequently edited the question.

  • My interpretation: Providing a boolean option that can be passed to a document class. – Dr. Manuel Kuehner Jan 6 '19 at 16:56
  • is that code fragment related to a configuration file? Nothing in the part that you posted suggests that it is? – David Carlisle Jan 6 '19 at 16:56
  • 1
    if your question is "what is a dtx file" then it isn't a configuration file it is the documented source for the package, it contains both the package code and the documentation of that code. – David Carlisle Jan 6 '19 at 16:58
  • Looks like defining book keys with xkeyval package syntax – user31729 Jan 6 '19 at 17:01
  • I notice that you have received answers to some of your questions, yet you have not accepted any answer. Please consider marking answers as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?) if they answered the question. This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. ... – moewe Jan 10 '19 at 21:11

*.dtx files are part of the doc system for specifying, packaging and documenting code. For full information (> texdoc doc) to view the manual. Essentially a .dtx file can consist of snippets of TeX code, textual explanations, user manual, etc. The snippets can be extracted from the file and placed in a number of output files to provide, say, a complete package, example uses of such a package, and a user manual. A single .dtx could contain the code for several packages each to be output as separate files.

It provides a way for code developers to basically wrap everything up into a single file rather than separate code, example, manual files which, if anything changed, would have to be updated separately (provided the coder remembered) whereas all can be done in a coordinated fashion in the .dtx

Mind you, creating a .dtx is not necessarily for the faint-hearted but most users need never see a .dtx as it is normally expanded.

| improve this answer | |

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