Some usage records of latex thesis writing __latex

Source: Internet
Author: User
Common Macro Package Totals
\usepackage{amsmath}
\usepackage{booktabs}
\usepackage{amssymb}
\usepackage{amsbsy}
\ Usepackage{multirow}
%\usepackage{float}
\usepackage{graphicx}
\usepackage{subfigure}
\ Usepackage{array}
\usepackage{caption}
\usepackage{url}

%\usepackage{algorithmic}
%\ Usepackage{algorithm}
%\usepackage{algorithmic}
%\usepackage{algpseudocode}
%\usepackage{ Pseudocode}
%\usepackage{algorithm}
\usepackage{algorithmic}

\usepackage{array}
\ newcolumntype{l}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1 ]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{r}[1]{>{\raggedleft\ let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
Picture

* Test picture source Half meta: monitor is not 10 x [manual Blink] Basic usage

\BEGIN{FIGURE}[HTBP]
	\centering% center
	\includegraphics[width=0.7\textwidth]{test.pdf}
    \caption{Add caption here.}
     \label{fig:test}
\end{figure}
Picture Alignment

The example above is center aligned, and the corresponding left and right alignment.

\BEGIN{FIGURE}[HTBP]
	\raggedright% left-aligned
	\includegraphics[width=0.3\textwidth]{test.jpg}
    \caption{ Align Left.}
     \label{fig:tag_left}
\end{figure}
\begin{figure}[htbp]
	\raggedleft% right-aligned
	\includegraphics[ Width=0.3\textwidth]{test.jpg}
    \caption{align right.}
     \label{fig:tag_right}
\end{figure}

There are other ways to achieve alignment
Syntax similar to \centering?
One way is to use adjustbox macro package, but the general Ctex (old version, the new edition is not made) and did not install the macro package, learned not to, scattered the

\documentclass{article}
\usepackage[export]{adjustbox}

\begin{document}

\begin{figure}
    \ Includegraphics[width=.6\textwidth,center]{example-image}
    \caption{centered image}
\end{figure}

\ Begin{figure}
    \includegraphics[width=.6\textwidth,left]{example-image}
    \caption{left aligned image}
\end{figure}

\begin{figure}
    \includegraphics[width=.6\textwidth,right]{example-image}
    \caption{ Right aligned image}
\end{figure}

\end{document}

There are several other ways to do this:

\BEGIN{FIGURE}[HTBP]
	\flushleft% left, corresponding to \flushright right
	\includegraphics[width=0.3\textwidth]{test.jpg}
    \caption{flushright.}
\end{figure}

\begin{figure}
	\hfill\includegraphics[width=0.3\textwidth]{test.jpg}% Violent right justification
	\caption{\ Texttt{hfill}
\end{figure}

\begin{figure}
	% The Minipage environment is used here, but the difference is caption on
	\hfill\begin{ Minipage}{.5\textwidth}\centering 
	\includegraphics{n}
	\caption{\texttt{minipage}}
	\end{minipage }
\end{figure}

multi-picture typesetting

I often use the subfigure environment, using the macro-package graphicx and subfigure
Here is an example of two graphs, of course more graphs can also drop

\BEGIN{FIGURE}[HTBP]
\centering
\subfigure[caption for 1]{
\label{fig.sub.1}
\ Includegraphics[width=0.4\textwidth]{test.jpg}}
\subfigure[caption for 2]{
\label{fig.sub.2}
\ Includegraphics[width=0.4\textwidth]{test.jpg}}
\caption{subfigure with two IMGs.}
\label{fig:demo_sub}
\end{figure}

For other uses, here are some references
Insert multiple figures in Latex
Placing Figures/tables side-by-side (\subfig)
How to arrage multiple figures?
Using the MultiRow Environment
The use of multirow and multicolumn can solve most of the typesetting problem, here the source code of the MultiRow method and the results are as follows:

\documentclass[a4paper]{article} \usepackage[demo]{graphicx} \usepackage{multirow} \begin{document} \begin{figure} [h] \centering \begin{tabular}{c@{}c@{}} \multirow{-6}{*}{\includegraphics[height=1cm,angle=90]{vertical.jpg } & \begin{tabular}{l} \includegraphics[trim = 0mm 0mm 0mm 0mm, clip, width=0.7\linewidth]{1.jp
        G} \tabularnewline \includegraphics[trim = 0mm 0mm 0mm 0mm, clip, width=0.7\linewidth]{1.jpg} \tabularnewline \includegraphics[trim = 0mm 0mm 0mm 0mm, clip, width=0.7\linewidth]{1.jpg} \tabularnewline \end{tabular} \tabula Rnewline & \multicolumn{1}{c}{\includegraphics[width=0.4\linewidth,height=1cm]{horizontal.jpg}} \end{tabular
      } \caption{test} \label{figtest} \end{figure} \begin{figure}[h] \centering \begin{tabular}{c@{}c@{}} \multirow{-4}{*}{\rotatebox{90}{\large \bfseries Error (mm)}} & \begin{tabular}{l} \includegr Aphics[trim = 0mm 0mm 0mm 0mm, clip, width=0.7\linewidth]{1.jpg} \tabularnewline \includegraphics[trim = 0mm 0mm 0mm 0mm, clip, width=0.7\linew Idth]{1.jpg} \tabularnewline \includegraphics[trim = 0mm 0mm 0mm 0mm, clip, width=0.7\linewidth]{1.jpg} \tabularne Wline \end{tabular} \tabularnewline & \tabularnewline & \large \bfseries time (s) \tabularnewli  Ne \end{tabular} \caption{other Test} \label{figothertest} \end{figure} \end{document}

Table Basic Usage

The most commonly used three-wire table

\BEGIN{TABLE}[!HTBP]
\caption{a simple table}
\centering
\BEGIN{TABULAR}{CCC}
\toprule
M1 & M2 & M3 \
\midrule
T1 & A & B \
T2 & c & D \
\bottomrule
\end{tabular}< C12/>\end{table

table alignment and column width settings

A rough but easy way.

\BEGIN{TABLE}[!HTBP]
\caption{a simple table with width}
\centering
%\BEGIN{TABULAR}{CCC}
\ Begin{tabular}{p{1cm}<{\flushleft}p{1cm}<{\centering}p{1cm}<{\raggedleft}}
\toprule
M1 & M2 & M3 \
\midrule
T1 & A & B \
T2 & c & D \
\bottomrule
\end{tabular}
  \end{table}

When the column is more, this kind of writing will be longer, look not too elegant (to elegant ~)
And then I found a kind of ash.

\usepackage{array}
\newcolumntype{l}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{c}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{R }[1]{>{\raggedleft\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}

\BEGIN{TABLE}[!HTBP]
\caption{A Simple table with nice width setting.}
\centering
%\BEGIN{TABULAR}{CCC}
%\begin{tabular}{p{1cm}<{\flushleft}p{1cm}<{\centering}p{1cm} <{\raggedleft}
\begin{tabular}{l{1cm}c{1cm}r{1cm}}
\toprule
M1 & M2 & M3 \
\midrule
T1 & A & B \
T2 & C & D \
\bottomrule
\end{tabular}
\end{table}

Complex table Structure

As previously mentioned in the picture, using MultiRow and multicolumn can solve most of the typesetting problems
Here is a simple example to illustrate the specific use of

\BEGIN{TABLE}[!HTBP]
%\small
\renewcommand{\arraystretch}{1.1

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.