Posted in LaTeX, Matlab on March 31st, 2006 6 Comments »
manually writing out matlab matrices in latex is really tedious. here’s how to save yourself the time: assume you have some matrix L >> s = sym(L); >> v = vpa(s,5); # assign numerical precision >> latex(v) matlab should now spit out the latex source code that you can directly copy into your .tex file.
Posted in LaTeX on March 30th, 2006 6 Comments »
you might want to use monospaced strings in latex to reproduce things like filenames. (where monospace refers to fonts like courier, where every character takes up the same amount of line space.) here’s an example of how to do it: The matrix $C_{i,j}$ is calculated in the uploaded file \texttt{loadComplex.m}.
Posted in LaTeX on March 29th, 2006 5 Comments »
to split a long, multiline formula over two lines, import the “amsmath” package and use the “split command” and double slashes. for instance, to produce the above equation, use the following code: \usepackage{amsmath} … \begin{split} \arg\max_\Theta\left[\sum_zP(\mathcal{G}|\mathcal{D},\mathcal{S}) P(\mathcal{G}|\mathcal{S},\Theta_n)\log{P(\mathcal{D}|\mathcal{G}, \mathcal{S},\Theta)}\right. \\ + \left.\sum_zP(\mathcal{G}|\mathcal{D},\mathcal{S})P(\mathcal{G}| \mathcal{S},\Theta_n)\log{P(\mathcal{D}|\mathcal{G},\mathcal{S},\Theta)}\right] \end{split}
Posted in LaTeX on March 29th, 2006 11 Comments »
to produce the above equation, use the following code: \begin{split} \arg\max_\Theta\left[\sum_zP(\mathcal{G}|\mathcal{D},\mathcal{S}) P(\mathcal{G}|\mathcal{S},\Theta_n)\log{P(\mathcal{D}|\mathcal{G}, \mathcal{S},\Theta)}\right. \ + \left.\sum_zP(\mathcal{G}|\mathcal{D},\mathcal{S})P(\mathcal{G}| \mathcal{S},\Theta_n)\log{P(\mathcal{D}|\mathcal{G},\mathcal{S},\Theta)}\right] \end{split} note that to produce the single-sided brackets, you need to add empty \left and \right brackets, which can be done by inserting periods following the \left or \right statement.
Posted in LaTeX on March 29th, 2006 22 Comments »
to write argmax with respect to some variable (i.e. theta), code: \arg\max_\theta
Posted in LaTeX on March 21st, 2006 2 Comments »
here’s a quick bit of sample code for making a table in latex. note that i’ve left out things like vertical and horizontal lines for now; it’s really late at night. \begin{center} $\begin{array}{ccc} & \mbox{wild-type} & \mbox{mutant} \\ C_1 & 0.9035 & 0.9328 \\ C_2 [\mbox{ M}^{-1}] & 0.0003 & -0.0001 \\ C_3 & 0.0259 […]
Posted in LaTeX on February 23rd, 2006 6 Comments »
if you’re trying to fit a choose statement into an equation in latex, you might be tempted to use nchoosek (as i was). that doesn’t work though. try this instead: N \choose{2} to print the equivalent of “n choose 2.”
Posted in LaTeX on February 23rd, 2006 10 Comments »
to insert a figure in latex, try the following code: \begin{figure}[h] \begin{center} \includegraphics[width=4in]{your_file.jpg} \end{center} \caption{your_caption} \end{figure} note that you can adjust the size of your figure using the width parameter; height should simultaneously scale proportionately.
Posted in LaTeX on January 24th, 2006 5 Comments »
i’ve never really understood those small default latex margins. perhaps they’re for some kind of really small paper. in any case, if you’re printing on regular letter-sized paper (8.5 X 11) and don’t want to kill so many trees, try the following document settings: \documentclass[12pt,letterpaper]{article} \setlength\textwidth{6in} \setlength\textheight{8in} \setlength\oddsidemargin{0.25in} % LaTeX adds a default 1in to […]