Hi Keita-San,
Ikumi Keita <[email protected]> wrote:
> Thanks for providing a sample. What I'm worrying about is validity of a
> construct like this:
> % \begin{equation}
> %%
> %% comment about the following equality
> %%
> % x^{2}+y^{2} = z^{2}
> % \end{equation}
>
> If this notation is valid in .dtx file, lines with only two %'s should
> not be considered as delimeter for math expression.
I took the two files posted by Arash. After line 47 of dtx-test.dtx:
% \end{macrocode}
I inserted this:
% Test:
% \begin{equation}
%%
%% comment about the following equality
%%
% x^{2}+y^{2} = z^{2}
% \end{equation}
When I compile this modified .dtx file with pdflatex (see the attached
file), I get:
! Missing $ inserted.
<inserted text>
$
l.50 %%
?
Line 50 is the one following the above \begin{equation}. So, it seems to
me that the '%%' (line 50) became a blank line when producing the
documentation, which triggered the expected error since it was
encountered in math mode. Do you experience otherwise? Maybe I am
misunderstanding something, though.
Regards
--
Florent
%
% \iffalse
%<*driver>
\documentclass{ltxdoc}
\begin{document}
\DocInput{dtx-test.dtx}
\end{document}
%</driver>
% \fi
%
% \title{The dtx-test package} \author{My Name} \maketitle
% \section{User Macros}
%
% \DescribeMacro{\SomeMacro} does this. Also some math $a+b=c$.
% ^^A Comment within documentation.
%
%% \noindent 2 \% lines get into \verb|.sty| and the documentation;
%% math looks like this:\\ $a + b = c$ and $a + b =
%% c$
%%
% ^^A This is not valid code:
% ^^A %% $a + b =
% ^^A %%
% ^^A %% c$
%
% \section{Implementation}
%
% \begin{macrocode}
%<*package>
% \end{macrocode}
%
% \begin{macrocode}
\def\mathfoo#1{%
$#1$%
}
% \end{macrocode}
%
% \begin{macrocode}
\def\mathbar#1{%
$foobar%
% \end{macrocode}
% This is a valid \LaTeX-construct in the |.sty| file;
% run |M-x texmathp RET| here:
% \begin{macrocode}
#1$%
}
% \end{macrocode}
% Test:
% \begin{equation}
%%
%% comment about the following equality
%%
% x^{2}+y^{2} = z^{2}
% \end{equation}
%
% \begin{macrocode}
%</package>
% \end{macrocode}
%
% \endinput
% Local Variables:
% mode: doctex
% TeX-master: t
% End: