六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 47|回复: 0

简单的LaTex例子

[复制链接]

升级  84%

10

主题

10

主题

10

主题

童生

Rank: 1

积分
42
 楼主| 发表于 2013-2-4 20:01:13 | 显示全部楼层 |阅读模式
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
以后在慢慢研究吧。
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表