简单的LaTex例子

full circle issue 11 上看到的。名字叫"introduction to latex"。确实很简单。下面是代码,随便什么文本编辑器,存为一个后缀为.tex的文件,如my.tex。

这个代码格式太烂了。源代码见附件。

\documentclass[a4paper,12pt]{article}
\usepackage{graphicx}
\usepackage{multicol}
\title{My LaTeX Primer}
\author{Wang Ning}

\begin{document}

\maketitle
\clearpage
\tableofcontents
\clearpage
\listoftables
\clearpage
\listoffigures
\clearpage

\section{Equations}

I will begin by adding a famous equation to the document, and referencing the equation in the text.

Einstein published important papers in 1905, and one of them was Special Relativity, popularly known as \ref{eqn1}.

\begin{equation}
\label{eqn1}
E = mc^2
\end{equation}

where, E represents energy, m the mass of the object, and c the speed of light.

I will make my second equation. This should be like \ref{eqn2}.

\begin{equation}
\label{eqn2}
a = b^c
\end{equation}

This means nothing. But I create it.

\section{Table}

Now we will insert a table containing a fictional list of names and ages. Table \ref{table1} contains...

\begin{table}[!ht]
\caption{A table to contain ages and names}
\label{table1}
\begin{center}
\begin{tabular}{|c|c|}
\hline
Name & Ages\\
\hline
Bob & 24\\
Dave & 13\\
Lucy & 27\\
Claire&12\\
\hline
\end{tabular}
\end{center}
\end{table}

\section{Columns}

It is very easy to add multiple columns to the document:

\begin{multicols}{2}
LOTS OF CONTENT LOTS OF CONTENT LOTS OF CONTENT LOTS OF CONTENT LOTS OF CONTENT LOTS OF CONTENT LOTS OF CONTENT LOTS OF CONTENT LOTS OF CONTENT LOTS OF CONTENT LOTS OF CONTENT LOTS OF CONTENT LOTS OF CONTENT LOTS OF
\end{multicols}

\section{Image}

Here is a picture as image \ref{image1} shows.

\begin{figure}[!ht]
\caption{Penguin Image}
\label{image1}
\begin{center}
\includegraphics[width=3in]{tux.png}
\end{center}
\end{figure}

\end{document}

 这里面有个图片,叫tux.png,随便找个图片方上去就可以。

然后系统中要有pdflatex命令。在命令行下运行$pdflatex my.tex,就输出pdf文件了。效果还不错。

文章最后还推荐了一个不错的文档:http://www.ctan.org/tex-archive/info/lshort/english/lshort.pdf

以后在慢慢研究吧。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值