Latex Tips Summary

Source: Internet
Author: User
default font in English and Chinese

Using Xelatex + XECJK Package

Setmainfont Setting the main font, i.e. English font

Setcjkmainfont Chinese Font

\USEPACKAGE{XECJK}
\setmainfont{times New Roman}
\setcjkmainfont[boldfont=hei]{hei}
\setcjkmonofont{ Hei}
Merge Cells

Go from: http://blog.csdn.net/wzxlovesy/article/details/69063271 Merging rows of multiple-column cells

Merging 1 rows of multiple columns can be done using \multicolumn{cols}{pos}{text}

\documentclass[a4paper,12pt]{report}
\usepackage[utf8,nopunct]{ctex}

\begin{document}

\begin{table }
	\centering
	\begin{tabular}{|c|c|c|c|}
		\hline
		\multicolumn{2}{|c|} {Merge one row two columns} & three & four \
		\hline
		1 & 2 & 3 & 4 \
		\hline
	\end{tabular}
\end{table}< C19/>\end{document}

merge multiple rows of a column of cells

Merging multiple rows of 1 column cells can be implemented with \multirow{rows}{width}{text} in the MultiRow package

Note that the 2nd parameter here is {width}, which is different from the \multicolumn 2nd parameter. If you're not sure what you need to fill in {width}, replace it with *, as shown in the code

Note: The following code in the 2nd row of the Table 1th column filled in ~, this symbol is placed here to indicate that this cell is not filled, but must keep the empty space, otherwise it will produce text overlay and table is not aligned, you can try yourself, temporarily not here to demonstrate the effect, so as not to confuse.

\documentclass[a4paper,12pt]{report}
\usepackage[utf8,nopunct]{ctex}
\usepackage{multirow}

\begin{ Document}

\begin{table}
	\centering
	\begin{tabular}{|c|c|c|c|}
		\hline
		\multirow{2}*{Merge two rows and one column} & two & three & four \
		~ & 2 & 3 & 4 \
		\hline
	\end{tabular}
\end{table}

\end{document}

Notice that there is no dash here, and if you insert a \hline directly between lines 1th and 2nd, this dash crosses the 1th cell

\begin{table}
	\centering
	\begin{tabular}{|c|c|c|c|}
		\hline
		\multirow{2}*{Merge two rows a column} & two & three & four \
		~ & 2 & 3 & 4 \
		\hline
	\end{tabul AR}
\end{table}

The workaround is to strip the line from column 2nd to the end, using the command \cline{start-end}

\begin{table}
	\centering
	\begin{tabular}{|c|c|c|c|}
		\hline
		\multirow{2}*{Merge two rows and one column} & two & three & four \
		\cline{2-4}
		~ & 2 & 3 & 4 \
		\hline
  \end{tabular}
\end{table}

merge multiple rows of multiple-column cells

There are several ways to combine multiple rows and columns, providing only one way to feel more comfortable with personal use, that is, combining \multicomumn and \multirow to achieve

For example, we want to insert a cell that merges 2 rows and 2 columns

\documentclass[a4paper,12pt]{report}
\usepackage[utf8,nopunct]{ctex}
\usepackage{multirow}

\ Begin{document}

\begin{table}
	\centering
	\begin{tabular}{|c|c|c|c|}
		\hline
		\multicolumn{2}{|c|} {\multirow{2}*{merges two rows and two columns}}  & three & four \
		\cline{3-4}
		\multicolumn{2}{|c|} {~} & 3 & 4 \
		\hline
	\end{tabular}
\end{table}

\end{document}

Note: Here in the second row using \multicolumn to make space placeholder, so you can avoid some strange lines, if the direct use of ~ & ~ & ... The way to occupy a bit, will be subject to the form of a dash {|c|c|c|c|} The effect of the more uniform vertical line, as follows

\begin{table} \centering \begin{tabular}{|c|c|c|c|} \hline \multicolumn{2}{|c|} {\multirow{2}*{Merge two rows two columns}} & three & four \ \cline{3-4} ~ & ~ & 3 & 4 \ \hline \end{tabular} \end{tabl e} 

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.