ddoc latex/formulas?

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Thu Sep 15 07:43:56 PDT 2016


On 09/15/2016 10:37 AM, Johan Engelen wrote:
>
> Well, I'm pretty sure just typing \( \) and running `dmd -D` is not
> going to give me the output that I want. Indeed it doesn't.
>
> But, as you write, it's easy to make it happen. Full example:
> ```
> /**
> * Macros:
> * DDOC =
> * <!DOCTYPE html>
> * <html lang="en-US">
> * <head>
> * <script type="text/javascript" async
> src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML">
>
> * </script>
> * <title>$(TITLE)</title>
> * </head>
> * <body><h1>$(TITLE)</h1>$(BODY)</body>
> * </html>
> */
>
> /**
> * \[
> *  \mathbf{V}_1 \times \mathbf{V}_2 =
> *   \begin{vmatrix}
> *    \mathbf{i} & \mathbf{j} & \mathbf{k} \\
> *    \frac{\partial X}{\partial u} & \frac{\partial Y}{\partial u} & 0 \\
> *    \frac{\partial X}{\partial v} & \frac{\partial Y}{\partial v} & 0 \\
> *   \end{vmatrix}
> * \]
> */
>
> module ddoctest;
> ```
>
> `dmd ddoctest.d -D -o-` produces an HTML file with nice looking math in it.
>
> Now, can we please add this question to stackoverflow, and add this as
> an answer?
> :)

Probably a wiki page would be an awesome idea. -- Andrei



More information about the Digitalmars-d mailing list