Welcome~~~


Another blog:
http://fun-st.blogspot.com/

It is easier to write an incorrect program than understand a correct one.

Friday, March 4, 2011

Some Notes for Latex

Figure & table
http://texblog.wordpress.com/category/figure-table/

# Multiple Columns: 
with this :   \begin{tabular}{|r|c|c|c|c|c|}
Simply use the *(star) symbol:    \begin{tabular}{|r*{5}{|c}|}

# Latex will automatically adjust the width of a cell in a table. If you wish to have a table where each cell in a row has the same width, you would use the p option instead of l, c or r for left, centre or right alignment.

Example:
\begin{table}[ht]
\centering
\begin{tabular}{|p{1cm}|p{1cm}|}
\hline
a&bbb\\
\hline
a&bbb\\
a&bbb\\
\hline
\end{tabular}
\end{table}

#Dynamic scaling of figure width
http://texblog.wordpress.com/2010/05/13/dynamic-scaling-of-figure-width/

Placing figures/tables side-by-side (\minipage)
August 1, 2007 in Figure & table, LaTex, Tips & tricks | Tags: article, book, code, figure, LaTex, minipage, report, table, tabular
Including images in a report is very common in Latex. Structuring your work nicely is probably the most obvious reason why you want to put two figures/tables side-by-side. Another reason might be to save space, wherever a smaller size of an image is sufficient. The following code can be used to place two figures side-by-side by creating a minipage…
\begin{figure}[ht]
\begin{minipage}[b]{0.5\linewidth}
\centering
\includegraphics[scale=1]{filename1}
\caption{default}
\label{fig:figure1}
\end{minipage}
\hspace{0.5cm}
\begin{minipage}[b]{0.5\linewidth}
\centering
\includegraphics[scale=1]{filename2}
\caption{default}
\label{fig:figure2}
\end{minipage}
\end{figure}
Note that for JPEG images the graphics package is required:
\usepackage{graphics}
The same “local column” – effect can be achieved for tables. The following code shows you how:
\begin{table}[ht]
\begin{minipage}[b]{0.5\linewidth}\centering
\begin{tabular}{|c|c|c|}
\hline
1&1&1\\
\hline
2&2&2\\
\hline
\end{tabular}
\end{minipage}
\hspace{0.5cm}
\begin{minipage}[b]{0.5\linewidth}
\centering
\begin{tabular}{|c|c|c|}
\hline
1&1&1\\
\hline
2&2&2\\
\hline
\end{tabular}
\end{minipage}
\end{table}
You can also have more than two column simply by adding another \minipage in between the table-command and reduce the width of each \minipage (0.33\linewidth for three columns) in addition to the \hspace. LaTex will automaticaly place objects onto the next line, if space is not sufficient.
Remark: Using the subfigure-package is another way to place figures or tables side-by-side. You might want to have a look at this post on subfigures.

No comments:

Post a Comment