PDF verssion of D manuals

Bill Baxter dnewsgroup at billbaxter.com
Thu Dec 14 17:16:41 PST 2006


BCS wrote:
> Walter Bright wrote:
>> BCS wrote:
>>
>>> Here is the first attack
>>
>>
>> It's a good start. If you can write up the roadblocks you're 
>> encountering, I can try and figure out a way to deal with them.
> 
> 
> The problem for tables is that TeX defines tables sizes with a syntax 
> like this
> 
> \begin{table}[llll]
>     % a table with 4 col.
>     ....
> \end{table}
> 
> the string that needs to be inserted into the template is the sequence 
> of "l", for which there needs to be one for each col. Some sort of 
> translation from "4" to "llll" is needed.

I'm pretty certain you could write a TeX macro to do that.  Don't ask me 
how though.  :-)  Then DDoc macro would spit out something like 
\some_els{4}, which would then be processed by a LaTeX macro into 'llll'.

Supposedly TeX is a Turing complete programming language, so it should 
be possible.  Just maybe not fun.

But in the end it would probably easier to have ddoc spit out some sort 
of meta-TeX, and use a perl/python/ruby/D script to grep through the 
result for special commands.

I.e. you could have the DDoc macro spit out

\begin{table}[@@@'l'*4@@@]
    ...
\end{table}

And use python/perl to grep for all @@@...@@@ patterns and run eval() on 
the text it finds there.

Of course I understand the desire to make DDoc capable of doing this on 
its own, but DDoc macros will probably never be a full-fledged 
programming language, so at some point you just have to give up and use 
something that is.  In fact you could argue that going DDoc->TeX->pdf is 
already such a situation.  Why not DDoc->ScriptyLanguage->TeX->pdf?

--bb



More information about the Digitalmars-d-announce mailing list