LaTeX Optional Arguments

Example from the guide: \newcommand{\example}[2][YYY]{Mandatory arg: #2; Optional arg: #1.} This defines \example to be a command with two arguments, referred to as #1 and #2 in the {<definition>}–nothing new so far. But by adding a second optional argument to this \newcommand (the [YYY]) the first argument (#1) of the newly defined command \example is … Read more

Breaking a list into multiple columns in Latex

Using the multicol package and embedding your list in a multicols environment does what you want: \documentclass{article} \usepackage{multicol} \begin{document} \begin{multicols}{2} \begin{enumerate} \item a \item b \item c \item d \item e \item f \end{enumerate} \end{multicols} \end{document}

LaTeX: Prevent line break in a span of text

\mbox is the simplest answer. Regarding the update: TeX prefers overlong lines to adding too much space between words on a line; I think the idea is that you will notice the lines that extend into the margin (and the black boxes it inserts after such lines), and will have a chance to revise the … Read more

Getting the error “Missing $ inserted” in LaTeX

The “Missing $ inserted” is probably caused by the underscores and bars. These characters in LaTeX have special meaning in math mode (which is delimited by $ characters). Try escaping them; e.g. update\_element instead of update_element. However, if you’re trying to display code, a better solution would be to use the \verb command, which will … Read more

Referring to a table in LaTeX [closed]

You must place the label after a caption in order to for label to store the table’s number, not the chapter’s number. \begin{table} \begin{tabular}{| p{5cm} | p{5cm} | p{5cm} |} — cut — \end{tabular} \caption{My table} \label{table:kysymys} \end{table} Table \ref{table:kysymys} on page \pageref{table:kysymys} refers to the …

How to write LaTeX in IPython Notebook?

IPython notebook uses MathJax to render LaTeX inside html/markdown. Just put your LaTeX math inside $$. $$c = \sqrt{a^2 + b^2}$$ Or you can display LaTeX / Math output from Python, as seen towards the end of the notebook tour: from IPython.display import display, Math, Latex display(Math(r’F(k) = \int_{-\infty}^{\infty} f(x) e^{2\pi i k} dx’))

How to order citations by appearance using BibTeX?

There are three good answers to this question. Use the unsrt bibliography style, if you’re happy with its formatting otherwise Use the makebst (link) tool to design your own bibliography style And my personal recommendation: Use the biblatex package (link). It’s the most complete and flexible bibliography tool in the LaTeX world. Using biblatex, you’d … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)