`
daning
  • 浏览: 90150 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

简单的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

以后在慢慢研究吧。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics