0

I'm trying to generate documentation using SWI Prolog PlDoc package, but I'm running into a problem with the environment defined in pldoc.sty:

\newcommand{\tag}[1]{%
    \item[#1]}
...
%   \begin{tags} ... \end{tags}

\newenvironment{tags}%
    {\begin{quote}\begin{description}%
        \setlength{\itemsep}{0pt}%
        \footnotesize}%
    {\end{description}\end{quote}}

This is used in the generated TeX file as follows:

\subsection{automata.pl: High-level predicates for dealing with regular expressions}

\label{sec:automata}

\begin{tags}
    \tag{See also}
\url{https://github.com/wvxvw/intro-to-automata-theory}
    \tag{To be done}
Add \predref{match_suffix_regex}{3}, \predref{match_all_regex}{3}, \predref{find_regex}{3}
\end{tags}

Which I insert into a larger document as follows:

\documentclass[11pt]{article}
...
\usepackage{amsmath}
...
\usepackage{pldoc}
...
\begin{document}
...
\section{Appendix A}
\label{sec:orgheadline18}
\input{automata-doc}
\end{document}

When I try to generate PDF using latexmk with pdflatex I receive the following error:

! Package amsmath Error: \tag not allowed here.

See the amsmath package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.253     \tag
              {See also}

However, when I generate standalone documentation (which does not use amsmath package), this error doesn't happen. My guess is that amsmath is messing things up, but I don't know how to prevent it from interfering.

10
  • 1
    \tag is an important command in amsmath -- the definition in your .sty file clashes here. Since I've no access to pldoc.sty I can't test, but I suggest to copy the \tag definition from pldoc.sty and rename it \pltag, as well replacing any \tag{...} in your real document with \pltag{...} accordingly.
    – user31729
    Commented Sep 20, 2015 at 21:22
  • @ChristianHupfer technically, the .sty isn't my. Should I write to the maintainer to alert them to the problem, or is this something that I can remedy locally (without having to modify the said .sty)?
    – wvxvw
    Commented Sep 20, 2015 at 21:23
  • 1
    You should not modify the .sty at all. Writing to the maintainer is certainly a good idea
    – user31729
    Commented Sep 20, 2015 at 21:24
  • Note that LaTeX must have given earlier errors. It will have told you that \tag was not available to be created as a new command, for example. You ignore such errors at your peril!
    – cfr
    Commented Sep 20, 2015 at 23:27
  • 1
    Well, a publisher might if they don't want you using those package anyway. That way, you don't have to change the source much in order to produce the output they want. Same way different classes all define \section{}. That's not coincidence either! But since this package isn't part of TeX Live and I have no idea what it is for or where to find it, I can't say whether this has any relevance or not ;).
    – cfr
    Commented Sep 21, 2015 at 1:18

2 Answers 2

1

I had the same problem and I modified the Prolog and LaTeX code to get things right. You can find the modified files and some instructions on GitHub in the repository AltPldoc. https://github.com/francomorando/AltPldoc

0
0

It appears that the maintainer isn't willing to change the STY provided with the documentation generator: https://github.com/SWI-Prolog/packages-pldoc/issues/11

I lack the knowledge to try to patch this myself, so, the only way I found around the problem was to generate the code documentation and the rest of the article separately and then join the two resulting PDFs following these (or similar) instructions: https://askubuntu.com/a/18691/638782

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .