13.11.2015 Views

my Latex and Tex4ht cheat sheet

my Latex cheat sheet - 12000.org

my Latex cheat sheet - 12000.org

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

This generates the <strong>Latex</strong> file p.tex<br />

\documentclass[12pt,titlepage]{article}<br />

\begin{document}<br />

It is known that $\sin(0)=0$<br />

\end{document}<br />

Using Python<br />

import math<br />

s=r"""<br />

\documentclass[12pt,titlepage]{article}<br />

\begin{document}<br />

It is known that $\sin(0)="""+repr(math.sin(0))+r"""$<br />

\end{document}"""<br />

text_file = open(r"C:\tmp\p.tex", "w")<br />

text_file.write(s)<br />

text_file.close()<br />

The above generates the <strong>Latex</strong> file<br />

\documentclass[12pt,titlepage]{article}<br />

\begin{document}<br />

It is known that $\sin(0)=0.0$<br />

\end{document}<br />

From C++ (needs C++11)<br />

#include <br />

#include <br />

#include <br />

using namespace std;<br />

int main()<br />

{<br />

//int r = 5;<br />

string s =R"(<br />

\documentclass[12pt,titlepage]{article}<br />

\begin{document}<br />

It is known that (a) $\sin(\pi)=)" + std::to_string(sin(M_PI)) + R"($<br />

\end{document}<br />

)";<br />

}<br />

cout

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!