MOE icon indicating copy to clipboard operation
MOE copied to clipboard

[C++] latex-ify C++ docs

Open suntzu86 opened this issue 10 years ago • 0 comments

When we first made the move to autodoc the C++ with doxygen+sphinx+breathe, I essentially just put double backticks around all existing mathy expressions so that at least the expression would render as it did in a text editor. i.e., we'd get mus = K(Xs,X) * K(X,X)^-1 * f = Ks^T * K^-1 * f instead of mus = K(Xs,X) * K(X,X)^-1 * f = Ks^T * K^-1 * f.

For longer expressions, I also did:

blah blah expression::

  mus = K(Xs,X) * K(X,X)^-1 * f = Ks^T * K^-1 * f
  mus = K(Xs,X) * K(X,X)^-1 * f = Ks^T * K^-1 * f

blah blah

It'd be nice to convert these to LaTeX.

This task is mostly mindless but there are some gotchas:

  1. the current docs are written to read well in a text editor like emacs or vim. They use latex-like syntax but they are not correct latex. In many places, variable names are multi-character (e.g., to match up with the variable name in code)

  2. I used several latex macros that I custom defined in my paper-writing days. nothign too complex but still. The major ones are these:

    \newcommand{\pderiv}[2]{\frac{\partial #1}{\partial #2}}
    \newcommand{\ppderiv}[2]{\frac{\partial^2 #1}{\partial #2^2}}
    \newcommand{\mixpderiv}[3]{\frac{\partial^2 #1}{\partial #2 \partial #3}}
    
  3. I dont' use correct left/right delimiters. So I'd write |x| but it should be \left| x \right| (better yet, make a command \norm), etc.

  4. We should take care that the result is still reasonably human-readable. latex can get really hideous.

suntzu86 avatar Aug 14 '14 06:08 suntzu86