http://blog.csdn.net/pipisorry/article/details/54571521php
總的來講,LaTex是一套排版系統,與word那種所見即所得對排版方式不太,用LaTex排版更像是寫程序同樣,將想要的排版效果用指令寫出來,再經過LaTex編譯成文檔。簡單來講,你只要按照要求撰寫tex文件,就可以經過LaTex生成排版好的pdf文件。
有些人可能聽到寫程序就頭大了,其實使用命令來排版的好處正是咱們能夠將各類版式作成模板文件,使用者只要調用模板便可,徹底不用去處理字體樣大小、位置,目錄生成,圖片公式序號等諸多細節,使咱們專一於內容。更多關於LaTex和word的比較這篇文章有很詳細的論述。css
LaTex也是能夠用來作簡歷,PPT等文檔的html
LaTeX文件的一般語法以下:node
\documentstyle{article}linux
\begin{document}git
This is a first example of a simple inputfile.github
\end{document}web
若是是中文,將\documentstyle{article}改成\documentstyle{carticle}算法
(1)空格:Latex中空格不起做用。
(2)換行:用控制命令「\\」,或「 \newline」.
(3)分段:用控制命令「\par」 或空出一行。
(4)換頁:用控制命令「\newpage」或「\clearpage」
(5)特殊控制字符:#,$, %, &, - ,{, }, ^, ~編程
\rm 羅馬字體 \it 意大利字體
\bf 黑體 \sl 傾斜體
\sf 等線體 \sc 小體大寫字母
\tt 打字機字體 \mit 數學斜體
\smallskip \medskip \bigskip
\textwidth=14.5cm
\textheight=21.5cm
系統默認:字號10pt= 五號字;西文字體爲羅馬字體;textwidth=12.2cm,textheight=18.6cm。至關於美國標準信紙大小。
(1)下面給出的是中文LaTeX2e模板,此時文件的擴展名爲.ctx。模板中%後面的中文是中文註解,讀者能夠閱讀這些模板中的中文註解,以理解所涉及的LaTeX2e命令的含義。
\documentclass[11pt]{ccart}%文件類說明
%還能夠選擇的類是cctbook
\setlength{\parindent}{12pt}%天然段第一行的縮進量爲12pt
\setlength{\parskip}{10pt plus1ptminus1pt}
%天然段之間的距離爲10pt,並可在8pt到11pt之間變化
\setlength{\baselineskip}{8pt plus2ptminus1pt}
%行間距爲8pt,並可在7pt到10pt之間變化
\setlength{\textheight}{21truecm}%版面高爲21釐米
\setlength{\textwidth}{14.5truecm}%版面寬爲14.5釐米
\begin{document}%正文開始
\title{Thesis}%文章標題,雙反斜槓\\表示換行
\author{author\\Dept. of Math.}
%做者名,單位,通訊地址等,雙反斜槓\\表示換行
\date{2003/8/5}
%文章寫做日期,若是省略此行,計算機日期做爲寫做日期
\maketitle%創建標題部分
%文章的正文輸入
\begin{center}%參考文獻的書寫
{\heiti 參考文獻}
\end{center}
\vskip 0.1cm
\def\hang{\hangindent\parindent}
\def\textindent#1{\indent\llap{#1\enspace}\ignorespaces}
\def\re{\par\hang\textindent}
\re{[1]} Nordhaus E,Stewart B,WhiteA.On theMaximum Genus of a Graph.{\it J.combinatorial TheoryB},1971,11:258-267
\re{[2]} Skoviera M.The Maximum Genus of Graphsof Diameter Two.{\it Discrete Math}.1991, 87:175-180
\end{document}%源文件的結束
\documentclass[11pt]{article}%文件類說明
%還能夠選擇的類是book,report
\setlength{\parindent}{12pt}%天然段第一行的縮進量爲12pt
\setlength{\parskip}{10pt plus1ptminus1pt}
%天然段之間的距離爲10pt,並可在8pt到11pt之間變化
\setlength{\baselineskip}{8pt plus2ptminus1pt}
%行間距爲8pt,並可在7pt到10pt之間變化
\setlength{\textheight}{21truecm}%版面高爲21釐米
\setlength{\textwidth}{14.5truecm}%版面寬爲14.5釐米
\begin{document}%正文開始
\title{Thesis}%文章標題,雙反斜槓\\表示換行
\author{author\\Dept. of Math.}
%做者名,單位,通訊地址等,雙反斜槓\\表示換行
\date{2003/8/5}
%文章寫做日期,若是省略此行,計算機日期做爲寫做日期
\maketitle%創建標題部分
%文章的正文輸入
\section{Introduction}%第一節引言(機器自動編號)
{\bf Theorem 1.} {\it For any fixed $\rho>0$,we have
$$||R(u,\rho)||\leq ||R_1(u,\rho)||\leq2||R(u,\rho)||,~~~\forall u\in H.
\eqno(10)$$ Hence, (2) and (3) are equivalent forany fixed$\rho>0$.}
%通常定理的寫法
{\bf Proof.}
\begin{thebibliography}{99}
\bibitem{Kind} D. Kinderlehrer and G.Stampacchia, {\it An Introduction to
Variational Inequalities and Their Applications},Academic Press,New York, (1980).
\end{thebibliography}%參考文獻
\end{document}%源文件的結束
\documentclass{article}
%這裏是導言區
\begin{document}
Hello, world!
\end{document}
1
\documentclass{article} 中包含了一個控制序列(或稱命令/標記)。所謂控制序列,是以反斜槓\開頭,以第一個空格或非字母 的字符結束的一串文字,他們並不被輸出,可是他們會影響輸出文檔的效果。這裏的控制序列是 documentclass,它後面緊跟着的 {article} 表明這個控制序列有一個必要的參數,該參數的值爲 article。這個控制序列的做用,是調用名爲 「article」 的文檔類。
Note: TeX 對控制序列的大小寫是敏感的
部分控制序列還有被方括號[]包括的可選參數。
所謂文檔類,便是 TeX 系統預設的(或是用戶自定的)一些格式的集合。不一樣的文檔類在輸出效果上會有差異。
\documentclass[options]{class}
article 排版科技期刊、短報告、程序文檔、邀請函等。
report 排版多章節的長報告、短篇的書籍、博士論文等。
book 排版書籍。
slides 排版幻燈片。其中使用了較大的sans serif 字體。也能夠考慮使用FoilTEX 來獲得相同的效果。
2
TeX 風格的文檔中,從 「%」 開始,到該行末尾的全部字符,都會被 TeX 系統無視,只做爲供人類閱讀的註釋。除非在 「%」 前加上反斜槓來取消這一特性。
3
控制序列 begin,這個控制序列老是與 end 成對出現。這兩個控制序列以及他們中間的內容被稱爲「環境」;他們以後的第一個必要參數老是一致的,被稱爲環境名。
只有在 「document」 環境中的內容,纔會被正常輸出到文檔中去或是做爲控制序列對文檔產生影響。也就是說,在 \end{document} 以後插入任何內容都是無效的。
\begin{document} 與 \documentclass{article} 之間的部分被稱爲導言區。導言區中的控制序列,一般會影響到整個輸出文檔。好比,咱們一般在導言區設置頁面大小、頁眉頁腳樣式、章節標題樣式等等。
.tex LATEX 或TEX 源文件。能夠用latex 處理。
.sty LATEX 宏包文件。可以使用命令\usepackage 將其加載到你的LATEX 文件中。
.dtx 文檔化TEX 文件。這也是LATEX 宏包發佈的主要格式。經過處理一個
.dtx 文件就能夠獲得該LATEX 宏包中所包括的宏代碼文檔。
.ins 爲相應的.dtx 文件的安裝文件。若是你在網絡上下載了一LATEX 宏包,你一般會發現會有一個.dtx 和一個.ins 文件。使用LATEX 對.ins文件進行處理,能夠從.dtx 文件中提取出宏包。
當你運行LATEX 處理你的源文件時,會獲得下列文件:
.dvi 與設備無關文件。這是LATEX 編譯運行的主要結果。你可使用DVI預覽器瀏覽其內容,或者使用像dvips 這樣的應用程序輸出到打印機。
.log 記錄了上次編譯運行時的詳細信息。
.toc 存儲了全部章節標題。該文件將在下次編譯運行時被讀入並生成目錄。
.lof 相似.toc 文件,可生成圖形目錄。
.lot 相似.toc 文件,可生成表格目錄。
.aux 另外一個用來向下次編譯運行傳遞信息的輔助文件。除了其它信息外,.aux 文件一般包含交叉引用信息。
.idx 若是你的文件中包含有索引,LATEX 使用此文件存儲全部的索引詞條。此文件須要使用makeindex 處理。
.ind 通過處理後的.idx 文件。可在下次編譯運行時加入到你的文檔中。
.ilg 運行makeindex 時生成的記錄文件。
示例awesome-cv.cls
awesome-cv的class file,能夠在其餘latex file中引用,例如在 ./example/resume.tex中:
\documentclass[11pt, a4paper]{awesome-cv}
每個class file中都會以如下兩行指令作開頭
\NeedsTeXFormat{LaTeX2e} %告訴Compiler此class是用哪一版
\ProvidesClass{my_cv}[2011/03/26 My custom CV class]
Note: Latex中.cls文件和.sty文件的區別和聯繫:.cls和.sty文件是用來提升LaTeX的排版效果的補充文件。它們分別用命令\documentclass{...}和命令\usepackage{...}來裝載到LaTeX文件。.cls文件一般被稱爲「classes」(也就是「類」),而.sty文件被稱爲「style files」(樣式文件),或者就簡單地稱其爲「packages」(包)。經過命令\documentclass{...}來裝載一個類是強制性的,並且在LaTeX文件裏可能只出現一次;一般它是第一個命令。不一樣的是,包是可選的,並且它們能夠在須要時隨時被裝載(不過必定是在正文開頭以前)。總而言之,.cls和.sty文件被LaTeX文件裝載以提供或改善產生文檔的方法。通常而言,類文件實現文檔的特定結構,而包包既能夠用於提供從屬於文檔的功能,又能夠改變特定的類文件提供的方法的風格。[.cls和.sty文件的做用和區別]
LaTeX 容許你在本身編寫的宏包(e.g. .cls文件中)中調用其它宏包,命令爲RequirePackage
所謂宏包,就是一系列控制序列的合集。這些控制序列太經常使用,以致於人們會以爲每次將他們寫在導言區太過繁瑣,因而將他們打包放在同一個文件中,成爲所謂的宏包(臺灣方面稱之爲「巨集套件」)。\usepackage{·}能夠用來調用宏包。
在引言中調用。
指定字體\usepackage{times}
package latexsym, which defines all symbols known from the old LaTeX version.
\documentclass[UTF8]{ctexart}
\title{你好,world!}
\author{Liam}
\date{\today}
\begin{document}
\maketitle
你好,world!
\end{document}
Note: 這裏是用的ctex,改爲article也能夠,可是不能顯示中文了,lz目前不寫中文的,因此先無論了。
定義了標題、做者、日期
maketitle這個控制序列能將在導言區中定義的標題、做者、日期 按照預約的格式展示出來。
\documentclass[UTF8]{ctexart}
\title{你好,world!}
\author{Liam}
\date{\today}
\begin{document}
\maketitle
\section{你好中國}
中國在East Asia.
\subsection{Hello Beijing}
北京是capital of China.
\subsubsection{Hello Dongcheng District}
\paragraph{Tian'anmen Square}
is in the center of Beijing
\subparagraph{Chairman Mao}
is in the center of 天安門廣場。
\subsection{Hello 山東}
\paragraph{山東大學} is one of the best university in 山東。
\end{document}
在上一節的文檔中,找到 \maketitle
,在它的下面插入控制序列 \tableofcontents
設置頁邊距,推薦使用 geometry
宏包。能夠在這裏查看它的說明文檔。
好比我但願,將紙張的長度設置爲 20cm、寬度設置爲 15cm、左邊距 1cm、右邊距 2cm、上邊距 3cm、下邊距 4cm,能夠在導言區加上這樣幾行:
\usepackage{geometry} \geometry{papersize={20cm,15cm}} \geometry{left=1cm,right=2cm,top=3cm,bottom=4cm}
設置頁眉頁腳,推薦使用 fancyhdr
宏包。能夠在這裏查看它的說明文檔。
好比我但願,在頁眉左邊寫上個人名字,中間寫上今天的日期,右邊寫上個人電話;頁腳的正中寫上頁碼;頁眉和正文之間有一道寬爲 0.4pt 的橫線分割,能夠在導言區加上以下幾行:
\usepackage{fancyhdr} \pagestyle{fancy} \lhead{\author} \chead{\date} \rhead{152xxxxxxxx} \lfoot{} \cfoot{\thepage} \rfoot{} \renewcommand{\headrulewidth}{0.4pt} \renewcommand{\headwidth}{\textwidth} \renewcommand{\footrulewidth}{0pt}
CTeX
宏集已經處理好了首行縮進的問題(天然段前空兩格漢字寬度)。
不使用
CTeX
宏集(使用xeCJK
宏包)的話,請遵守如下提示操做。中國人寫文章,習慣每一段的段首都空出兩個中文漢字的長度。美國人沒有這個習慣,他們每一小節的段首都頂格。爲了解決這個問題,咱們能夠在導言區調用
\usepackage{indentfirst}
.就算是這樣,首行縮進的長度,仍然不符合中國人的習慣。咱們能夠在導言區添加這樣的控制序列
\setlength{\parindent}{\ccwd}
來調整首行縮進的大小。這裏的\ccwd
是當前字號下一個中文漢字的寬度。
咱們能夠經過 setspace
宏包提供的命令來調整行間距。好比在導言區添加以下內容,能夠將行距設置爲字號的 1.5 倍:
\usepackage{setspace}
\onehalfspacing
具體能夠查看該宏包的文檔。
請注意用詞的差異:
- 行距是字號的 1.5 倍;
- 1.5 倍行距。
事實上,這不是設置 1.5 倍行距的正確方法,請參考:http://liam0205.me/2013/10/17/LaTeX-Linespace/
咱們能夠經過修改長度 \parskip
的值來調整段間距。例如在導言區添加如下內容
\addtolength{\parskip}{.4em}
則能夠在原有的基礎上,增長段間距 0.4em。若是須要減少段間距,只需將該數值改成負值便可。
somewords {\it somewords} somewords
\bf 黑體字;粗體鉛字
\it Italics
\tt Typewriter (monospace, fixed-width).打字型印刷鉛字
\emph Although it also changes fonts, the \emph{text} commandis semantic, for text to be emphasized, and should not be used as asubstitute for \textit. For example, \emph{starttext \emph{middle text} end text} will result in thestart text and end text in italics, but middle textwill be in roman.
The \em command is the unconditional version of \emph.
。。。
(如用於批改)
{\color{red}{[??]}}
The following commands are for use in math mode. They are not cumulative, so \mathbf{\mathit{symbol}} does not create a boldface and italic symbol; instead, it will just be in italics. This is because typically math symbols need consistent typographic treatment, regardless of the surrounding environment.
\mathrm
Roman, for use in math mode.
\mathbf
Boldface, for use in math mode.
\mathsf
Sans serif, for use in math mode.
\mathtt
Typewriter, for use in math mode.
\mathit
(\mit)
Italics, for use in math mode.
\mathnormal
For use in math mode, e.g., inside another type style declaration.
\mathcal 書法字體
Calligraphic letters, for use in math mode. Note: 大寫字母纔有書法字體,小寫的是無效的。
\MakeUppercase{abc} ABC
\MakeLowercase
首字母大寫(只能對第一個有效)
\usepackage{stringstrings}
\capitalize{abc abc} Abc abc
整個字符串全部單詞首字母大寫
。。。有點複雜沒寫
google: latex uppercase the first letter of each word in a sentence
The standard classes, article, report and book support 3 different font sizes, 10pt, 11pt, 12pt (by default 10pt). The font size is set through the optional argument, e.g.:
\documentclass[12pt]{report}
use the extsizes package. It allows for the following font sizes: 8pt, 9pt, 10pt, 11pt, 12pt, 14pt, 17pt, 20pt.
%Article
\documentclass[9pt]{extarticle}
%Report
\documentclass[14pt]{extreport}
[Changing the font size in LaTeX]
\fontsize{字體尺寸}{行距},只有使用\selectfont命令以後,\fontzize{}{}的設置才能生效。
\fontsize{10pt}{12pt}\selectfont 這樣後面的字體都變成10pt大小了。
點數(pt) 相應中文字號 控制命令
25 一號 \Huge
20 二號 \huge
17 三號 \LARGE
14 四號 \Large
12 小四號 \large
10 五號 \normalsize(default)
9 小五號 \small
8 六號 \footnotesize
7 小六號 \scriptsize
5 七號 \tiny
執行fc-list:lang=zh-cn命令查詢簡體中文的字體。同理查詢繁體中文字體能夠用fc-list:lang=zh-tw命令,查詢日語字體能夠用fc-list:lang=ja。
lz列出經常使用的幾個示例:
SimSun,宋體:style=Regular,常規
KaiTi,楷體:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standa
STXingkai,華文行楷:style=Regular
Microsoft YaHei,微軟雅黑,Microsoft YaHei Light,微軟雅黑 Light:style=Light,Regular
Microsoft YaHei,微軟雅黑:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
YouYuan,幼圓:style=Regular
FangSong,仿宋:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
SimHei,黑體:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
NSimSun,新宋體:style=Regular,常規
/usr/share/fonts/方正蘭亭黑.TTF: FZLanTingHeiS\-R\-GB,方正蘭亭黑簡體:style=Regular
方式1
linux latex 中文不顯示
解決:使用xelatex編譯(不然可能直接報錯,而不是不顯示中文了)
且加入
\usepackage{fontspec}
\setmainfont{SimSun} %宋體
就能夠顯示中文了
方式2
%使用支持漢字的CJK包
\usepackage{CJK}
%開始CJK環境,只有在這句話以後,你才能使用漢字。另外,若是在Linux下,請將文件的編碼格式設置成GBK,不然會顯示亂碼。
\begin{CJK*}{GBK}{song}
加粗或加斜某幾個中文
使用\bf或者\textbf加粗中文無效果。
西文的習慣是使用加粗、傾斜、花體等來強調內容,而漢語的習慣則是使用不一樣的字形來強調內容。因此,通常的建議都是將粗宋體改用黑體,斜體之類的也改用仿宋、圓體之類的表示。
好比lz使用微軟雅黑代替中文加粗:\fontspec{Microsoft YaHei}\selectfont{求職意向:大數據算法工程師}
最好自定義一下:\newcommand{\yahei}[1]{\fontspec{Microsoft YaHei}\selectfont{#1}} 使用\yahei{求職意向:大數據算法工程師}
中文標題+中文正文+英文字體:
\RequirePackage{xeCJK} % 使用xeCJK宏包
\setCJKmainfont{方正蘭亭黑簡體} % 設置缺省中文字體
\setmainfont{Calibri} % 如不指定,使用Tex的默認英文字體
中文標題lz使用的是方正蘭亭粗黑簡體
使用包xeCJK後,隨時設置字體命令\fontspec會無效,要使用\CJKfontspec代替。
\part
\chapter
(report and book class only)
\section
\subsection
Note: \section*{Acknowledgments},標題不帶number
\subsubsection
\paragraph
\subparagraph
附錄appendix
The \appendix command changes the way following sectional unitsare numbered. The \appendix command itself generates no textand does not affect the numbering of parts. The normal use of thiscommand is something like
\chapter{A Chapter}
…
\appendix
\chapter{The First Appendix}
設置section字體爲微軟雅黑及其它設置說明
\newcommand{\yahei}[1]{\fontspec{Microsoft YaHei}\selectfont{#1}}
\titleformat{\section} % Customise the \section command
{\Large\scshape\raggedright\yahei} % Make the \section headers large (\Large),
% small capitals (\scshape) and left aligned (\raggedright)
{}{0em} % Can be used to give a prefix to all sections, like 'Section ...'
{} % Can be used to insert code before the heading
[\titlerule] % Inserts a horizontal line after the heading
\titlespacing*{\section}{0cm}{*1.8}{*1.8}
section可選參數
\section[short title]{long title}
• \label: Assign a symbolic name to a piece of text.
通常定義的方式最好以下:
ch
for chapters
sec
for lower-level sectioning commands
fig
for figures
tab
for tables
eq
for equations
• \pageref: Refer to a page number.
• \ref: Refer to a section, figure or similar.
對公式的引用建議使用\eqref,這樣會在公式引用自動添加()。
\label{stylefiles} #定義
?????? #引用
示例
多圖的插入
1 插入雙欄圖片時需在figure的上標中加入符號*
。雙列模式中的插圖:The starred form figure* is used when a document is in double-column mode (see \twocolumn). It produces a figure thatspans both columns, at the top of the page.這樣插圖佔兩列,而不是隻佔一列。
2 圖片插入的正確位置:初始引用頁面的最上或者最下位置。Like tables, figures cannot be split across pages; the best placement for them is typically the top or the bottom of the page nearest their initial cite.
3 關鍵性的語句是:\includegraphics[選項]{圖片.eps},其選項有:
height %指定圖片的高度
width %指定圖片的寬度 \includegraphics[width=3in]{file.eps} 將 file.eps 插入文檔而且它的寬度被縮放到 3 英寸,高度也會 按相應的比例縮放。若是用 \textwidth 或 \em 等的函數來 指定寬度,而不是用像 3 英寸這樣的固定尺寸,將會使你的 LATEX 文 檔更具通用性。例如:\includegraphics[width=\textwidth]{graphics.eps} 將所插入圖形縮放到和文本行的寬度同樣寬。width=0.8\textwidth 設置圖片爲0.8倍的文本寬度;width=\textwidth - 2.0in設置圖片爲文本寬度少2.0inches(當與 calc 宏包配合使用 時);
angle %指定圖片旋轉的角度 用graphicx包的includegraphics宏命令插入圖片時還可使圖片旋轉, 方法是 \includegraphics[height=高度][angle=旋轉角度]{圖片文件名}
scale %縮放圖形
trim 指定圖形能夠被看到的部分的另外一選項。所給出的四個數字 分別表明了從左、下、右、上被截去的值。正數表明今後方向 截去的大小,而負數則表明今後方向加上的大小。如\includegraphics[width=1\linewidth, trim=0 132 0 155]{./figures/framework0.eps}截取圖片上下的部分。lz一直沒搞清楚trim和clip使用,如\includegraphics[width=0.6\textwidth, clip=true, trim=98mm 40mm 88mm 35mm]{paper_organization.eps}顯示的並非想像的先截取eps文件中間的圖形,再放大爲0.6倍textwidth!![Displaying only part of an EPS picture]
其它選項[includegraphics 命令]
插入的圖形一般爲eps、pdf或者jpg、png等格式,假設名字叫fig,把它放在你的tex文檔同一目錄下。Note: 最佳的引用格式通常使用eps格式,若是使用pdflatex編譯,最好使用pdf格式圖片。.eps files to be displayable with LATEX. If you work with pdfL A TEX, use files in the .pdf format. Note that most modern TEX systems will convert .eps to .pdf for you on the fly. 若是是eps的圖形, 編譯過程是latex, dvips, ps2pdf. 若是是pdf jpg png圖形, 編譯過程是 pdflatex .
4 圖片描述/圖標題caption
若是想使用雙語描述,使用bicaption宏包:
\usepackage{bicaption}
\captionsetup[figure][bi-second]{name=Figure} %設置圖的英文編號前綴
\captionsetup[table][bi-second]{name=Table} %設置表的英文編號前綴
Note:也可使用ccaption 宏包,\usepackage{ccaption},將\caption命令換成以下:\bicaption{圖}{中文}{Fig}{English title},但這個宏包與caption宏包相互不兼容,很容易出錯。
5 圖標題和圖居中
\begin{figure}[!htbp]
\captionsetup{justification=centering} %圖標題強制居中
\centering %圖居中
\end{figure}
示例代碼
說明
在LaTeX文檔中插入圖片都是經過使用一些latex圖形處理宏命令來實現的, 有不少宏命令都支持在在LaTeX文檔中插入eps格式的圖形文件, 主要有:
用includegraphics宏命令(graphicx包)
首先需在latex文檔的文件說明部分加上:
\usepackage{graphicx}
而後在須要插入圖片的地方引用:
\includegraphics[height=高度]{圖片文件名} 或者: \includegraphics[width=寬度]{圖片文件名}
其中的"高度"和"寬度"是指但願圖片打印的高度和寬度, 必須給出單位, 可用釐米(cm)或英寸(in). 高度和寬度也可用上述格式同時給出, 這樣能夠改變原圖的長寬比例. 上述命令中的圖片文件名是指欲插入的圖片文件 的文件名, 圖片必需是eps格式的.(直接使用latex編譯不能插入jpg圖片,可是使用xelatex能夠)
一、先導言區加一句\usepackage{graphicx}
二、若是想插入inline的圖形, 直接使用
\includegraphics[width=5in]{fig},不用加後綴名。
三、若是你想插入浮動圖形, 使用
\begin{figure}[htbp]
\centering\includegraphics[width=3.5in]{fig}
\caption{something}
\label{fig:1}
\end{figure}
還有其它package插入的方法參考[LaTeX文檔插入圖片的幾種經常使用方法 ]
latex插圖的放置位置\begin{figure}[htbp]
圖形(figure)環境有一個可選參數項容許用戶來指示圖形有可能 被放置的位置。這一可選參數項能夠是下列字母的任意組合。
h 當前位置。 將圖形放置在 正文文本中給出該圖形環境的地方。若是本頁所剩的頁面不夠, 這一參數將不起做用。
t 頂部。 將圖形放置在頁面的頂部。
b 底部。 將圖形放置在頁面的底部 16.1。
p 浮動頁。 將圖形放置在一隻容許 有浮動對象的頁面上。
注:
若是在圖形環境中沒有給出上述任一參數,則缺省爲 [tbp]。
給出參數的順序不會影響到最後的結果。由於在考慮這些參數時 LATEX 老是嘗試以 h-t-b-p 的順序來肯定圖形的位置。因此 [hb] 和 [bh] 都使 LATEX 以 h-b 的順序來排版。
給出的參數越多, LATEX 的排版結果就會越好。 [htbp], [tbp], [htp], [tp] 這些組合獲得的效果不錯。
只給出單個的參數項極易引起問題16.2。 若是該圖形不適合所指定的位置,它就會被擱置並阻礙對後面的圖形 的處理。一旦這些阻塞的圖形數目超過了 18 幅這一 LATEX 所能允許 的最大值,就會產生 ``Too Many Unprocessed Floats'' 的錯誤(見 第 16.3 節)。
在浮動位置選項前加上一個驚歎號(如 \begin{figure}[!ht]) 會使 LATEX 忽略應用於文本頁的審美條件,試圖用最嚴格的標準來放置浮動圖形。不過, ! 不會影響應用於浮動頁的審美條件。
當 LATEX `` 試圖'' 放置一浮動圖形時, 它將遵循如下規則:
標準 LaTeX 提供有 array 和 tabular兩個製表環境,它們的完整格式以下:
or
這兩個環境的選項和參數定義是相同的,不過 array 主要用於數組矩陣的排版,且只能用在數學環境中,如equation 等。
array 宏包擴展了array 和 tabular環境功能,主要增長和加強了列樣式選項,甚至可編程定義新的列樣式;還增長了許多細部微調功能,如改變垂直表格線的粗細和自動調整表格間隙等。使用該宏包能夠排印出外形美觀、功能豐富的表格。
array
\begin{array}[pos]{cols}
column 1 entry &column 2 entry ... &column n entry \\
...
\end{array}
table的位置:通常初次引用頁的最上面。Because tables cannot be split across pages, the best placement for them is typically the top of the page nearest their initial cite.
To ensure this proper ``floating'' placement of tables, use the environment \textbf{table} to enclose the table's contents and the table caption. The contents of the table itself must go in the \textbf{tabular} environment, to be aligned properly in rows and columns, with the desired horizontal and vertical rules.
Note: 1 \caption放在主體下面時顯示也是在表格下面,放在主體上面就顯示在表格上面。
2 table*能夠橫跨兩頁面。
示例1(acm標準,三線圖)
示例2:另外一種三線圖的實現,lz以前用的,不過感受沒有acm標準那個好。
acm推薦使用的一個table格式包:booktabs
It is strongly recommended to use the package booktabs and follow its main principles of typography with respect to tables:
Never, ever use vertical rules.
Never use double rules.
It is also a good idea not to overuse horizontal rules.
參數
選項 | 說明 |
l |
該列左對齊排列 |
c |
該列居中排列 |
r |
該列右對齊排列 |
p{列寬} | 設置該列寬度,文本頂對齊。如須要哪一列自動換行,直接指定該列寬便可實現。(可是合併單元格後的就不會自動換行了,還沒解決這個問題) |
@{聲明} | 該列每行插入聲明中文本 |
m{列寬} | 設置該列寬度,文本居中對齊 |
b{列寬} | 設置該列寬度,文本底對齊 |
>{聲明} | 聲明能夠是命令或插入列元素以前的文本 |
<{聲明} | 聲明能夠是命令或插入列元素以後的文本 |
| | 列邊或列間加入一條垂直線 |
!{聲明} | 用聲明要求的樣式取代列間垂直線 |
*{num}{cols}
Equivalent to num copies of cols, where num is apositive integer and cols is a list of specifiers. Thus\begin{tabular}{|*{3}{l|r}|}
is equivalent to\begin{tabular}{|l|rl|rl|r|}
.
Note: 出錯Extra alignment tab has been changed to \cr是由於列數|c|c|...沒寫對。
使用makecell宏包來定製表格線,這個包提供了\Xhline來定製表格線。
\Xhline{1.2pt}
合併單元格
合併一行多列單元格
合併多行一列單元格
\begin{tabular}{|c|c|c|c|} \hline \multirow{2}*{合併兩行一列} & 二 & 三 & 四 \\ \cline{2-4} ~ & 2 & 3 & 4 \\ \hline \end{tabular}
合併多行多列單元格
description顧名思義,對列表項的解釋描述等,description項描述能夠是多個段落,也可多個環境嵌套。
\begin{description}
\item [first label] text of first item
\item [second label] text of second item
...
\end{description}
效果是首行不縮進,從第二行開始縮進。也能夠改變其表現[LaTeX技巧303:description列表不得不說的用法]。
有序列表 enumerate
有標號的縮進列表。\begin{enumerate}[itemindent=1em] %在這裏設置縮進的距離
\begin{enumerate}
\item [first label] text of first item
\item [second label] text of second item
...
\end{enumerate}
修改標號格式,如變成(1):
若是使用的是\usepackage{enumitem}則使用 \begin{enumerate}[itemsep=0pt, parsep=0pt,label=(\arabic*)]
列表標籤的控制指令有:
命令 | 例子 |
---|---|
\arabic | 1, 2, 3 ... |
\alph | a, b, c ... |
\Alph | A, B, C ... |
\roman | i, ii, iii ... |
\Roman | I, II, III ... |
\fnsymbol | 星號,單劍號,雙劍號等 |
若是使用的是\usepackage{enumerate}則使用 \begin{enumerate}[(1)]
使用混亂會出錯:
Undefined control sequence. \end{enumerate} OR
- Missing number, treated as zero.
\begin{itemize}
\item item1
\item item2
...
\end{itemize}
The itemize environment produces an 「unordered」, 「bulleted」list. Itemizations can be nested within one another, up to fourlevels deep. They can also be nested within other paragraph-makingenvironments, such as enumerate (see enumerate).
示例:
以上的列表環境空白較大,若是須要更緊湊的列表方式,能夠選用 mdwlist 宏包提供的 itemize*、enumerate* 和 description* 環境,用法和無星號的版本一致。
[在Latex使用條列式清單itemize , enumerate , description [轉]]
Note: 這個沒有研究過,感受可用於圖片插入,之後再研究。
8.20 引用quotation
and quote
\begin{quotation}
text
\end{quotation}
or
\begin{quote}
text
\end{quote}
使用BibTeX管理參考文獻
%% The file named.bst is a bibliography style file for BibTeX 0.99c
\bibliographystyle{named}
\bibliography{ijcai17}
ijcai17.bib內容:
@article{ gottlob:nonmon,
author = "Georg Gottlob",
title = "Complexity results for nonmonotonic logics",
journal = "Journal of Logic and Computation",
volume = "2",
number = "3",
pages = "397--425",
month = "June",
year = "1992"
}
Note: @article{ gottlob:nonmon...中的gottlob首字母必須小寫,不然引用能夠失敗。
簡寫
編寫bib文件時,若要使用一個簡寫來代替很長的字符串,可使用
@string(Abbrv="Long string")
好比: @string(TIT="IEEE Trans. Inf. Theory")
這樣在條目中,journal=TIT等價於journal={IEEE Trans. Inf. Theory}
注意使用簡寫的時候不要加大括號,大括號的做用是防止latex對內容作處理,好比在title中有些簡寫是須要大寫的,爲防止在參考文獻列表中把這些簡寫變成小寫字母,能夠在簡寫兩邊加上大括號。
正文中引用參考文獻 \cite[subcite]{keys}
The keys argument is a list of one or more citation keys, separated by commas. This command generates an in-text citation to the references associated with keys by entries in the .aux file. The text of the optional subcite argument appears after the citation. For example, \cite[p.~314]{knuth} might produce ‘[Knuth, p. 314]’.
\nocite: Include an item in the bibliography.The \nocite command produces no text, but writes keys,which is a list of one or more citation keys, to the .aux file.若要把沒引用的文檔列入參考文獻,用\nocite{}。\nocite{*}列入全部bib文件中的文獻。\nocite{*}命令是寫在.tex文件中而不是.bib文件。
Note: key通常取一做的姓和標題的一個詞。The key is a short reference you invent to uniquely identify each work; in this sample document, the key is the first author's surname and a word from the title.
示例
Gottlob~\shortcite{gottlob:nonmon} has shown that, rather than, In our previous work~\cite{gottlob:nonmon}
Gottlob [1992] has shown that, rather than, In our previous work [Gottlob, 1992]
單做:[Gottlob, 1992] 或者Nebel [2000](很容易看出來時)
二做:[Brachman and Schmolze, 1985]
多做:[Baumgartner et al., 2001]
多篇引用使用,隔開:[Gott-
lob et al., 2002; Levesque, 1984a]
latex代碼:\cite{gls:hypertrees,levesque:functional-foundations}
引用做者\citeauthor
如同時引用做者和文獻 Early,~\citeauthor{eagle2009inferring}~\cite{eagle2009inferring} examined the communications
結果Early, Eagle et al. [6] examined the communications
注意\citeauthor是由包\usepackage{natbib}提供,不然出錯。
其它包中添加這種行爲:
\documentclass{article} \usepackage{natbib} \begin{document} \citeauthor{lamport94} \citet{lamport94} \begin{thebibliography}{9} \bibitem[Lamport (1994)]{lamport94}Leslie Lamport, \emph{\LaTeX: A Document Preparation System}. Addison Wesley, Massachusetts, 2nd Edition, 1994. \end{thebibliography} \end{document}
[Problem displaying author in citation when using natbib's \citeauthor command]
\footnote
\footnote[number]{text}
LaTeX 提供了 \pagestyle 命令讓咱們能夠文檔全部頁面的樣式 (包括頁邊距, 頁眉和頁腳等內容); 同時, 還提供了 \pagenumbering 來設置頁碼的顯示格式. LaTeX 提供了四種不一樣的頁面樣式:
設置沒有頁眉,頁腳居中顯示自定義字符串
\usepackage{fancyhdr}
\renewcommand{\headrulewidth}{0.0pt} #去除頁眉的橫線bar
\pagestyle{fancy}
\fancyhf{} %\fancyhead{} #去除頁眉內容
\cfoot{Passion in my heart, Dynamic in my body!} #設置頁腳居中字符串
[How to remove the top horizontal bar in fancyhdr?]
\newcommand and \renewcommand define and redefine a command, respectively.
使用\newcommand能夠本身定製命令
語法格式 \newcommand{\yourcommand}[參數個數]{內容}
好比:\newcommand{\wuhao}{\fontsize{10.5pt}{10.5pt}\selectfont}用來定義一個選定字號命令
Here’s a command definition that uses arguments:
\newcommand{\defreference}[1]{Definition~??????}
Then, \defreference{def:basis} will expand to something like ‘Definition~3.14’.
\newcommand示例
\newcommand{\home}[2][]{\faHome\
\ifthenelse{\isempty{#1}}
{\href{#2}{#2}}
{\href{#2}{#1}}}
使用\home[***.github.io]{http://***.github.io/}
pdf效果點擊就能夠跳轉
不過lz沒有搞懂[2][]的用法,知道的麻煩給個連接吧?好比如何定義4個參數的兩個不一樣連接?
Note: \href{網址}{描述}:生成網址連接,以正常字體顯示描述,隱藏網址。
因此能夠簡單的使用\href{http://blog.csdn.net/pipisorry}{blog.csdn.net/pipisorry}來表示上面的連接。可是如何定義4個參數的兩個不一樣連接?
[How to use \newcommand for \href?]
\usepackage[colorlinks,
linkcolor=red,
anchorcolor=blue,
citecolor=green
]{hyperref}
Define a new theorem-like environment. Synopses:
\newtheorem{name}{title}[numbered_within]
\newtheorem{name}[numbered_like]{title}
\newtheorem{定理環境名}{標題}[主計數器名]
%例如
\newtheorem{theorem}{Theorem}[Chapter]
示例
\newtheorem{problem}{Problem}
示例1(lz都是使用這個來定義的!)
示例2:定義\newdef
\newdef{definition3}{Definition}
Note: lz也不知道\newdef是什麼意思。。。
• \indent: | Indent this paragraph. | |
• \noindent: | Do not indent this paragraph. Latex 換行頂格、不縮進 | |
• \parskip: | Space added before paragraphs. | |
• Marginal notes: | Putting remarks in the margin. |
經常使用數學符號的LaTeX 表示方法,數學符號表,請參考[WiKibook Mathematics][symbols] [unofficial reference manual16.2]
在Latex 中怎樣在指向左或右的箭頭上方標註字母?
宏包amsmath 提供了兩個能夠伸長的單箭頭符號
\xleftarrow[下方公式]{上方公式}
上方可輸入中文的雙向箭頭
雙向箭頭,且上方可輸入中文,且箭頭居中。
\usepackage{extarrows},$\xleftrightarrow{\text{社交聯繫}}$
或者$\stackrel{\underleftrightarrow{\text{社交聯繫}}}{}$,其中\stackrel{上層符號}{下層符號}表示將任意兩個符號重疊在一塊兒。
可使用\left和\right來顯示不一樣的括號:
功能 | 語法 | 顯示 |
---|---|---|
圓括號,小括號 | \left( \frac{a}{b}\right) | ![]() |
方括號,中括號 | \left[ \frac{a}{b}\right] | ![]() |
花括號,大括號 | \left\{ \frac{a}{b}\right\} | ![]() |
角括號 | \left \langle \frac{a}{b} \right\rangle | ![]() |
單豎線,絕對值 | \left| \frac{a}{b}\right| | ![]() |
雙豎線,範 | \left \| \frac{a}{b} \right\| | ![]() |
取整函數 (Floor function) |
\left \lfloor \frac{a}{b} \right\rfloor | ![]() |
取頂函數 (Ceiling function) |
\left \lceil \frac{c}{d} \right\rceil | ![]() |
斜線與反斜線 | \left / \frac{a}{b} \right\backslash | ![]() |
上下箭頭 | \left \uparrow \frac{a}{b} \right\downarrow | ![]() |
\left \Uparrow \frac{a}{b} \right\Downarrow | ![]() |
|
\left \updownarrow \frac{a}{b} \right\Updownarrow | ![]() |
|
混合括號 | \left [ 0,1 \right ) \left \langle \psi \right | |
![]() ![]() |
單左括號 | \left \{ \frac{a}{b} \right . | ![]() |
單右括號 | \left . \frac{a}{b} \right \} | ![]() |
備註:可使用\big, \Big, \bigg,\Bigg控制括號的大小,好比代碼\Bigg (\bigg [ \Big \{\big \langle \left | \| \frac{a}{b} \| \right |\big \rangle \Big \}\bigg ] \Bigg )顯示
LATEX 使用一種特殊的模式來排版數學符號和公式(mathematics)。段落中的數學表達式應該置於和和,$ 和$ 或者
之間。對於較大的數學式子,最好的方法是使用顯示式樣來排版:將它們放置於
或
之間。這樣排版出的公式是沒有編號的。若是你但願LATEX 對其添加編號的話,可使用equation 環境來達到這一目的。
數學模式和文本模式有不少不一樣之處。例如在數學模式中:空格和分行都將被忽略。全部的空格或是由數學表達式邏輯的衍生,或是由特殊的命令如\,,\quad 或\qquad 來獲得。在數學環境中($........$ 和
)生成空格請參考19 空格spaces。
不容許有空行,每一個公式中只能有一個段落。每一個字符都將被看做是一個變量名並以此來排版。若是你但願在公式中出現普通的文本(使用正體字並能夠有空格),那麼你必須使用命令\textrm{...} 來輸入這些文本。數學模式中的命令僅對其後面第一個字符起做用。因此,若是你但願某一命令做用於多個字符的話,那麼你就必須將它們放置於括號中:{...}。
。。。
小公式,lz通常使用$$環境實現。大公式,lz通常使用equation環境實現。
無numberd公式環境
有numbered公式環境:equation環境
\begin{equation}
math text
\end{equation}
Make a displaymath
environment (see displaymath) with anequation number in the right margin. The equation number is generated using the equation
counter.
示例
引用時候使用Eq. ??????
長公式
不對齊
無須對齊的長公式可使用 multline
環境。
效果:
若是不須要編號,可使用 multline*
環境代替。
對齊
須要對齊的公式,可使用 alig
ned 次環境來實現,它必須包含在數學環境以內。
效果圖:
&爲對齊指示符,這個是經常使用的。
固然也可使用下面這個進行長公式分行左對齊
無需對齊的公式組可使用 gather
環境,須要對齊的公式組可使用 align
環境。他們都帶有編號,若是不須要編號可使用帶星花的版本。
效果:
Latex中將下標放在正下方
Latex輸入數學公式時(特別是文字之間的公式),有時須要將公式的下標放在正下方。好比Max函數下面的取值範圍,須要放在Max的正下方。
方法1
$\max \limits_{a<x<b}\{f(x)\}$
可是對於雙$$之間的公式,Latex默認下標是放在正下方。因此就不須要加\limits。此方法在equation環境中一樣適用。
方法2
\usepackage{amsmath}
格式
\underset{下標}{表達式}
\underset{t}{\text{maxk}} \{
Note: 公式中不能直接寫入自定義的maxk這些字符,要使用\text{maxk},不然會變成這樣。另外若是latex自帶的字符如max應該直接使用\max。
• \maketitle: Generate a title page.
• \pagenumbering: Set the style used for page numbers.
• \pagestyle: Change the headings/footings style.
• \thispagestyle: Change the headings/footings style for this page.
\author{name \and name2}
The \author command declares the document author(s), where the argument is a list of authors separated by \and commands. Use \\ to separate lines within a single author’s entry—for example, to give the author’s institution or address.
\date{text}
The \date command declares text to be the document’s date. With no \date command, the current date (see \today) is used.
\thanks{text}
The \thanks command produces a \footnote to the title, usually used for credit acknowledgements.
\title{text}
The \title command declares text to be the title of the document. Use \\ to force a line break, as usual.
Horizontal space
• \hspace: Fixed horizontal space.
• \hfill: Stretchable horizontal space.
• \(SPACE) and \@: Space after a period.
• \(SPACE) after CS: Controlling space gobbling after a control sequence.
• \frenchspacing: Make interword and intersentence space equal.
• \thinspace: One-sixth of an em.
• \/: Insert italic correction.
• \hrulefill \dotfill: Stretchable horizontal rule or dots.
Vertical space
• \addvspace: Add arbitrary vertical space if needed.
• \bigskip \medskip \smallskip: Fixed vertical spaces.
• \vfill: Infinitely stretchable vertical space.
• \vspace: Add arbitrary vertical space.
行縮進2字符:使用\hspace{2em} #\indent好像無效不知爲啥
因爲LaTeX 採用的是源文件編譯方式, 默認LaTeX會忽略多餘的空格。
若是須要產生一個空格,可使用 命令\ , 注意表明的是空間鍵。例如: Jones, et al.\ (1993), 這樣就在 "."後產生了一個空格。符號~產生一個不可斷行的空格。即空格前的反斜線符號產生一個不能伸長的空格。波浪字符‘~’ 也產生一個不能伸長的空格,而且禁止斷行。
若是須要多個空格, 可使用多個\. 一個更方便生成水平方向的空格可使用命令\hspace{ 長度 } , 例如 \hspace{1cm},若是\hspace命令在一行的開始則須要改用\hspace*{1cm}來產生空格;若是要產生垂直方向的空白, 可以使用命令\vspace{ 長度 } 和 \vspace*{ 長度 }。
若是想在段落直接產生必定的間距, 則使用命令\medskip, \bigskip, 或 \smallskip.
爲了使輸出的右邊界對齊,LATEX在單詞間插入不等的間隔。在句子的末尾插入的空間稍多一些,由於這使得文本更具可讀性。LATEX假定句子以句號、問號或驚歎號結尾。若是句號緊跟一個大寫字母,它就不視爲句子的結尾。由於通常在有縮寫地方,纔出現句號緊跟大寫字母的狀況。
句號前的命令\@ 說明這個句號是句子的末尾,即便它緊跟一個大寫字母。對article風格的文檔,有下列分節命令:\section{...} \paragraph{...} \subsection{...}\subparagraph{...} \subsubsection{...} 對report 和book 風格的文檔,還有其餘兩個分節命令:\part{...} \chapter{...}。由於article風格的文檔不劃分爲章,因此很容易把它做爲一章插入書籍文檔中。節之間的間隔,節的序號和標題的字號由LATEX 自動設置。分節的兩個命令有些特殊性:命令\part 不影響章的序號。命令\appendix 不帶參量,只把章的序號改用爲字母標記。LATEX在文檔編譯的最後一個循環中,提取節的標題和頁碼以生成目錄。命令\tableofcontents在其出現的位置插入目錄。爲了獲得正確的目錄內容,一個新文檔必須編譯兩次。上面列出的分節命令也以「帶星」的形式出現。「帶星」的命令經過在命令名稱後加*來實現。它們生成的節標題既不出現於目錄,也不帶序號。例如,命令\section{Help} 的「帶星」形式爲\section*{Help}。目錄出現的標題,通常與輸入的文本徹底一致。有時這是不可能的,由於標題太長排不進目錄。在這種狀況下,目錄的條目可由真實標題前的可選參量肯定。
\chapter[Title for the table ofcontents]{A long and especially boring title, shown inthe text}
整篇文檔的標題由命令\maketitle產生。標題的內容必須在調用\maketitle 之前,由命令\title{...}, \author{...} 和可選的\date{...}定義。在命令\author 中,能夠輸入幾個用\and 命令分開的名字。\frontmatter 應接着命令\begin{document}使用。它把頁碼更換爲羅馬數字。對於正文前的內容廣泛使用帶星的命令(例如,\chapter*{Preface}),以阻止LATEX 對它們排序。\mainmatter應出如今書的第一章緊前面。它打開阿拉伯頁碼計數器,並對頁碼重新計數。\appendix 標誌書中附錄材料的開始。該命令後的各章序號改用字母標記。\backmatter應該插入與書中最後一部份內容的緊前面,如參考文獻和索引。在標準文檔類型中,它對頁面沒有什麼效果。
兩個quad空格 a \qquad b 兩個m的寬度
quad空格 a \quad b 一個m的寬度
大空格 a\ b 1/3m寬度
中等空格 a\;b 2/7m寬度
小空格 a\,b 1/6m寬度
緊貼 a\!b 縮進1/6m寬度
• Reserved characters: Inserting ‘# $ % & ~ _ ^ \ { }’
如何打出這些特殊字符? \ 使用\backslash,~使用\sim,{使用\{等等。latex雙引號``word'' [函數、符號及特殊字符][http://zh.wikipedia.org/wiki/Help:MATH]
• Text symbols: Inserting other non-letter symbols in text.
• Accents: Inserting accents.
• Non-English characters: Inserting other non-English characters.
• \rule: Inserting lines and rectangles.
• \today: Inserting today’s date.
\LaTeX
The LaTeX logo.
使用時後面要加一個{},不然空格會被忽略。somewords \LaTeX{} somewords.還能夠這樣使用:{\LaTeX{} and Word Style Files}。
在做者名字上加不一樣角標
[lshort-zh-cn.pdf]
\ldots
\dots
\textellipsis
An ellipsis (three dots at the baseline): ‘…’. \ldots and \dots also work in math mode.
latex下描寫算法的包主要有algorithmic, algorithmicx。這兩個宏包是被設計成同時一塊兒使用的,但也能夠根據用戶的特殊須要分開使用。其中 algorithm 宏包主要是爲算法提供一個浮動體環境,也就是說,在 LaTeX 中算法和圖像,表同樣,都是浮動體。algorithmic 宏包主要是用來完成算法的描述功能,該宏包提供了咱們描述算法經常使用的幾種結構命令,如條件結構、循環結構等。下面咱們就經過示例來對 algorithm 的使用進行講解。
Algorithmic 宏包,爲描述算法提供了程序設計中的全部經常使用結構的表示,如:判斷 (IF) ,循環 (WHILE, FOR, LOOP), 輸入(REQUIRE) ,輸出(ENSURE)等。
Algorithm 環境主要做用是將代碼段變成浮動體,浮動體一方面能防止代碼超出頁面範圍,另一方面也方面最後生成和圖表目錄類似的算法列表目錄。也能經過標記,方便在文章其它地方引用。
簡單示例
\usepackage{algorithm}
\usepackage{algorithmicx}
\floatname{algorithm}{算法}
\renewcommand{\algorithmicrequire}{\textbf{輸入:}}
\renewcommand{\algorithmicensure}{\textbf{輸出:}}
[LaTeX/Algorithms 僞代碼] [Latex 創建帶有豎線和編號的算法環境]
(如用在p{列寬}中)
絕對定位則是固定尺寸,它們採用的是物理度量單位:cm、mm、in、px、pt以及pc。
但在實際應用中,咱們使用最普遍的則是em、rem、px以及百分比(%)來度量頁面元素的尺寸。
長度的說明:
定義 \def\FRAMEWORK{online-offline unified framework}
引用 we introduce the {\it \FRAMEWORK}~ which can
[TeX 的宏]
文件名 {\tt ijcai17.sty}
連接名 {\tt http://www.ijcai-17.org/}
not強調 {\em not}
問題:
bib文件中的{Lixto}表明什麼意思?
from: http://blog.csdn.net/pipisorry/article/details/54571521
ref: [A simple guide to LaTeX]
[使用LaTex寫畢業論][一份其實很短的 LaTeX 入門文檔][始終:LaTeX 分類][lshort: http://ctan.mirror.rafal.ca/info/lshort/english/lshort.pdf]*
[LATEX與論文寫做]*
[Ctex社區:LaTeX 文檔 [LaTeX 2e 插圖指南(中文)]
[LaTeX Tutorials: A Primer http://www.tug.org/twg/mactex/tutorials/ltxprimer-1.0.pdf]
[LaTeX Beginner's Guide]
[texstudio help: LaTeX2e unofficial reference manual (October 2015)]*
[lshort-zh-cn.pdf]
[LaTeX簡介:入門文檔 huangxg 的 LaTeX Notes]
[ChinaTeX 論壇: 論壇 - ChinaTeX論壇]
[wikipedia en.wikibooks.org/wiki/LaTeX/Absolute_Beginners]
[知乎:關於 LaTeX 有什麼推薦的說明教程、指南一類的資料?]
http://blog.csdn.net/pipisorry/article/details/54571521
總的來講,LaTex是一套排版系統,與word那種所見即所得對排版方式不太,用LaTex排版更像是寫程序同樣,將想要的排版效果用指令寫出來,再經過LaTex編譯成文檔。簡單來講,你只要按照要求撰寫tex文件,就可以經過LaTex生成排版好的pdf文件。
有些人可能聽到寫程序就頭大了,其實使用命令來排版的好處正是咱們能夠將各類版式作成模板文件,使用者只要調用模板便可,徹底不用去處理字體樣大小、位置,目錄生成,圖片公式序號等諸多細節,使咱們專一於內容。更多關於LaTex和word的比較這篇文章有很詳細的論述。
LaTeX文件的一般語法以下:
\documentstyle{article}
\begin{document}
This is a first example of a simple inputfile.
\end{document}
若是是中文,將\documentstyle{article}改成\documentstyle{carticle}
(1)空格:Latex中空格不起做用。
(2)換行:用控制命令「\\」,或「 \newline」.
(3)分段:用控制命令「\par」 或空出一行。
(4)換頁:用控制命令「\newpage」或「\clearpage」
(5)特殊控制字符:#,$, %, &, - ,{, }, ^, ~
\rm 羅馬字體 \it 意大利字體
\bf 黑體 \sl 傾斜體
\sf 等線體 \sc 小體大寫字母
\tt 打字機字體 \mit 數學斜體
\smallskip \medskip \bigskip
\textwidth=14.5cm
\textheight=21.5cm
系統默認:字號10pt= 五號字;西文字體爲羅馬字體;textwidth=12.2cm,textheight=18.6cm。至關於美國標準信紙大小。
(1)下面給出的是中文LaTeX2e模板,此時文件的擴展名爲.ctx。模板中%後面的中文是中文註解,讀者能夠閱讀這些模板中的中文註解,以理解所涉及的LaTeX2e命令的含義。
\documentclass[11pt]{ccart}%文件類說明
%還能夠選擇的類是cctbook
\setlength{\parindent}{12pt}%天然段第一行的縮進量爲12pt
\setlength{\parskip}{10pt plus1ptminus1pt}
%天然段之間的距離爲10pt,並可在8pt到11pt之間變化
\setlength{\baselineskip}{8pt plus2ptminus1pt}
%行間距爲8pt,並可在7pt到10pt之間變化
\setlength{\textheight}{21truecm}%版面高爲21釐米
\setlength{\textwidth}{14.5truecm}%版面寬爲14.5釐米
\begin{document}%正文開始
\title{Thesis}%文章標題,雙反斜槓\\表示換行
\author{author\\Dept. of Math.}
%做者名,單位,通訊地址等,雙反斜槓\\表示換行
\date{2003/8/5}
%文章寫做日期,若是省略此行,計算機日期做爲寫做日期
\maketitle%創建標題部分
%文章的正文輸入
\begin{center}%參考文獻的書寫
{\heiti 參考文獻}
\end{center}
\vskip 0.1cm
\def\hang{\hangindent\parindent}
\def\textindent#1{\indent\llap{#1\enspace}\ignorespaces}
\def\re{\par\hang\textindent}
\re{[1]} Nordhaus E,Stewart B,WhiteA.On theMaximum Genus of a Graph.{\it J.combinatorial TheoryB},1971,11:258-267
\re{[2]} Skoviera M.The Maximum Genus of Graphsof Diameter Two.{\it Discrete Math}.1991, 87:175-180
\end{document}%源文件的結束
\documentclass[11pt]{article}%文件類說明
%還能夠選擇的類是book,report
\setlength{\parindent}{12pt}%天然段第一行的縮進量爲12pt
\setlength{\parskip}{10pt plus1ptminus1pt}
%天然段之間的距離爲10pt,並可在8pt到11pt之間變化
\setlength{\baselineskip}{8pt plus2ptminus1pt}
%行間距爲8pt,並可在7pt到10pt之間變化
\setlength{\textheight}{21truecm}%版面高爲21釐米
\setlength{\textwidth}{14.5truecm}%版面寬爲14.5釐米
\begin{document}%正文開始
\title{Thesis}%文章標題,雙反斜槓\\表示換行
\author{author\\Dept. of Math.}
%做者名,單位,通訊地址等,雙反斜槓\\表示換行
\date{2003/8/5}
%文章寫做日期,若是省略此行,計算機日期做爲寫做日期
\maketitle%創建標題部分
%文章的正文輸入
\section{Introduction}%第一節引言(機器自動編號)
{\bf Theorem 1.} {\it For any fixed $\rho>0$,we have
$$||R(u,\rho)||\leq ||R_1(u,\rho)||\leq2||R(u,\rho)||,~~~\forall u\in H.
\eqno(10)$$ Hence, (2) and (3) are equivalent forany fixed$\rho>0$.}
%通常定理的寫法
{\bf Proof.}
\begin{thebibliography}{99}
\bibitem{Kind} D. Kinderlehrer and G.Stampacchia, {\it An Introduction to
Variational Inequalities and Their Applications},Academic Press,New York, (1980).
\end{thebibliography}%參考文獻
\end{document}%源文件的結束
\documentclass{article}
%這裏是導言區
\begin{document}
Hello, world!
\end{document}
1
\documentclass{article} 中包含了一個控制序列(或稱命令/標記)。所謂控制序列,是以反斜槓\開頭,以第一個空格或非字母 的字符結束的一串文字,他們並不被輸出,可是他們會影響輸出文檔的效果。這裏的控制序列是 documentclass,它後面緊跟着的 {article} 表明這個控制序列有一個必要的參數,該參數的值爲 article。這個控制序列的做用,是調用名爲 「article」 的文檔類。
Note: TeX 對控制序列的大小寫是敏感的
部分控制序列還有被方括號[]包括的可選參數。
所謂文檔類,便是 TeX 系統預設的(或是用戶自定的)一些格式的集合。不一樣的文檔類在輸出效果上會有差異。
\documentclass[options]{class}
article 排版科技期刊、短報告、程序文檔、邀請函等。
report 排版多章節的長報告、短篇的書籍、博士論文等。
book 排版書籍。
slides 排版幻燈片。其中使用了較大的sans serif 字體。也能夠考慮使用FoilTEX 來獲得相同的效果。
2
TeX 風格的文檔中,從 「%」 開始,到該行末尾的全部字符,都會被 TeX 系統無視,只做爲供人類閱讀的註釋。除非在 「%」 前加上反斜槓來取消這一特性。
3
控制序列 begin,這個控制序列老是與 end 成對出現。這兩個控制序列以及他們中間的內容被稱爲「環境」;他們以後的第一個必要參數老是一致的,被稱爲環境名。
只有在 「document」 環境中的內容,纔會被正常輸出到文檔中去或是做爲控制序列對文檔產生影響。也就是說,在 \end{document} 以後插入任何內容都是無效的。
\begin{document} 與 \documentclass{article} 之間的部分被稱爲導言區。導言區中的控制序列,一般會影響到整個輸出文檔。好比,咱們一般在導言區設置頁面大小、頁眉頁腳樣式、章節標題樣式等等。
.tex LATEX 或TEX 源文件。能夠用latex 處理。
.sty LATEX 宏包文件。可以使用命令\usepackage 將其加載到你的LATEX 文件中。
.dtx 文檔化TEX 文件。這也是LATEX 宏包發佈的主要格式。經過處理一個
.dtx 文件就能夠獲得該LATEX 宏包中所包括的宏代碼文檔。
.ins 爲相應的.dtx 文件的安裝文件。若是你在網絡上下載了一LATEX 宏包,你一般會發現會有一個.dtx 和一個.ins 文件。使用LATEX 對.ins文件進行處理,能夠從.dtx 文件中提取出宏包。
當你運行LATEX 處理你的源文件時,會獲得下列文件:
.dvi 與設備無關文件。這是LATEX 編譯運行的主要結果。你可使用DVI預覽器瀏覽其內容,或者使用像dvips 這樣的應用程序輸出到打印機。
.log 記錄了上次編譯運行時的詳細信息。
.toc 存儲了全部章節標題。該文件將在下次編譯運行時被讀入並生成目錄。
.lof 相似.toc 文件,可生成圖形目錄。
.lot 相似.toc 文件,可生成表格目錄。
.aux 另外一個用來向下次編譯運行傳遞信息的輔助文件。除了其它信息外,.aux 文件一般包含交叉引用信息。
.idx 若是你的文件中包含有索引,LATEX 使用此文件存儲全部的索引詞條。此文件須要使用makeindex 處理。
.ind 通過處理後的.idx 文件。可在下次編譯運行時加入到你的文檔中。
.ilg 運行makeindex 時生成的記錄文件。
示例awesome-cv.cls
awesome-cv的class file,能夠在其餘latex file中引用,例如在 ./example/resume.tex中:
\documentclass[11pt, a4paper]{awesome-cv}
每個class file中都會以如下兩行指令作開頭
\NeedsTeXFormat{LaTeX2e} %告訴Compiler此class是用哪一版
\ProvidesClass{my_cv}[2011/03/26 My custom CV class]
Note: Latex中.cls文件和.sty文件的區別和聯繫:.cls和.sty文件是用來提升LaTeX的排版效果的補充文件。它們分別用命令\documentclass{...}和命令\usepackage{...}來裝載到LaTeX文件。.cls文件一般被稱爲「classes」(也就是「類」),而.sty文件被稱爲「style files」(樣式文件),或者就簡單地稱其爲「packages」(包)。經過命令\documentclass{...}來裝載一個類是強制性的,並且在LaTeX文件裏可能只出現一次;一般它是第一個命令。不一樣的是,包是可選的,並且它們能夠在須要時隨時被裝載(不過必定是在正文開頭以前)。總而言之,.cls和.sty文件被LaTeX文件裝載以提供或改善產生文檔的方法。通常而言,類文件實現文檔的特定結構,而包包既能夠用於提供從屬於文檔的功能,又能夠改變特定的類文件提供的方法的風格。[.cls和.sty文件的做用和區別]
LaTeX 容許你在本身編寫的宏包(e.g. .cls文件中)中調用其它宏包,命令爲RequirePackage
所謂宏包,就是一系列控制序列的合集。這些控制序列太經常使用,以致於人們會以爲每次將他們寫在導言區太過繁瑣,因而將他們打包放在同一個文件中,成爲所謂的宏包(臺灣方面稱之爲「巨集套件」)。\usepackage{·}能夠用來調用宏包。
在引言中調用。
指定字體\usepackage{times}
package latexsym, which defines all symbols known from the old LaTeX version.
\documentclass[UTF8]{ctexart}
\title{你好,world!}
\author{Liam}
\date{\today}
\begin{document}
\maketitle
你好,world!
\end{document}
Note: 這裏是用的ctex,改爲article也能夠,可是不能顯示中文了,lz目前不寫中文的,因此先無論了。
定義了標題、做者、日期
maketitle這個控制序列能將在導言區中定義的標題、做者、日期 按照預約的格式展示出來。
\documentclass[UTF8]{ctexart}
\title{你好,world!}
\author{Liam}
\date{\today}
\begin{document}
\maketitle
\section{你好中國}
中國在East Asia.
\subsection{Hello Beijing}
北京是capital of China.
\subsubsection{Hello Dongcheng District}
\paragraph{Tian'anmen Square}
is in the center of Beijing
\subparagraph{Chairman Mao}
is in the center of 天安門廣場。
\subsection{Hello 山東}
\paragraph{山東大學} is one of the best university in 山東。
\end{document}
在上一節的文檔中,找到 \maketitle
,在它的下面插入控制序列 \tableofcontents
設置頁邊距,推薦使用 geometry
宏包。能夠在這裏查看它的說明文檔。
好比我但願,將紙張的長度設置爲 20cm、寬度設置爲 15cm、左邊距 1cm、右邊距 2cm、上邊距 3cm、下邊距 4cm,能夠在導言區加上這樣幾行:
\usepackage{geometry} \geometry{papersize={20cm,15cm}} \geometry{left=1cm,right=2cm,top=3cm,bottom=4cm}
設置頁眉頁腳,推薦使用 fancyhdr
宏包。能夠在這裏查看它的說明文檔。
好比我但願,在頁眉左邊寫上個人名字,中間寫上今天的日期,右邊寫上個人電話;頁腳的正中寫上頁碼;頁眉和正文之間有一道寬爲 0.4pt 的橫線分割,能夠在導言區加上以下幾行:
\usepackage{fancyhdr} \pagestyle{fancy} \lhead{\author} \chead{\date} \rhead{152xxxxxxxx} \lfoot{} \cfoot{\thepage} \rfoot{} \renewcommand{\headrulewidth}{0.4pt} \renewcommand{\headwidth}{\textwidth} \renewcommand{\footrulewidth}{0pt}
CTeX
宏集已經處理好了首行縮進的問題(天然段前空兩格漢字寬度)。
不使用
CTeX
宏集(使用xeCJK
宏包)的話,請遵守如下提示操做。中國人寫文章,習慣每一段的段首都空出兩個中文漢字的長度。美國人沒有這個習慣,他們每一小節的段首都頂格。爲了解決這個問題,咱們能夠在導言區調用
\usepackage{indentfirst}
.就算是這樣,首行縮進的長度,仍然不符合中國人的習慣。咱們能夠在導言區添加這樣的控制序列
\setlength{\parindent}{\ccwd}
來調整首行縮進的大小。這裏的\ccwd
是當前字號下一個中文漢字的寬度。
咱們能夠經過 setspace
宏包提供的命令來調整行間距。好比在導言區添加以下內容,能夠將行距設置爲字號的 1.5 倍:
\usepackage{setspace}
\onehalfspacing
具體能夠查看該宏包的文檔。
請注意用詞的差異:
- 行距是字號的 1.5 倍;
- 1.5 倍行距。
事實上,這不是設置 1.5 倍行距的正確方法,請參考:http://liam0205.me/2013/10/17/LaTeX-Linespace/
咱們能夠經過修改長度 \parskip
的值來調整段間距。例如在導言區添加如下內容
\addtolength{\parskip}{.4em}
則能夠在原有的基礎上,增長段間距 0.4em。若是須要減少段間距,只需將該數值改成負值便可。
somewords {\it somewords} somewords
\bf 黑體字;粗體鉛字
\it Italics
\tt Typewriter (monospace, fixed-width).打字型印刷鉛字
\emph Although it also changes fonts, the \emph{text} commandis semantic, for text to be emphasized, and should not be used as asubstitute for \textit. For example, \emph{starttext \emph{middle text} end text} will result in thestart text and end text in italics, but middle textwill be in roman.
The \em command is the unconditional version of \emph.
。。。
(如用於批改)
{\color{red}{[??]}}
The following commands are for use in math mode. They are not cumulative, so \mathbf{\mathit{symbol}} does not create a boldface and italic symbol; instead, it will just be in italics. This is because typically math symbols need consistent typographic treatment, regardless of the surrounding environment.
\mathrm
Roman, for use in math mode.
\mathbf
Boldface, for use in math mode.
\mathsf
Sans serif, for use in math mode.
\mathtt
Typewriter, for use in math mode.
\mathit
(\mit)
Italics, for use in math mode.
\mathnormal
For use in math mode, e.g., inside another type style declaration.
\mathcal 書法字體
Calligraphic letters, for use in math mode. Note: 大寫字母纔有書法字體,小寫的是無效的。
\MakeUppercase{abc} ABC
\MakeLowercase
首字母大寫(只能對第一個有效)
\usepackage{stringstrings}
\capitalize{abc abc} Abc abc
整個字符串全部單詞首字母大寫
。。。有點複雜沒寫
google: latex uppercase the first letter of each word in a sentence
The standard classes, article, report and book support 3 different font sizes, 10pt, 11pt, 12pt (by default 10pt). The font size is set through the optional argument, e.g.:
\documentclass[12pt]{report}
use the extsizes package. It allows for the following font sizes: 8pt, 9pt, 10pt, 11pt, 12pt, 14pt, 17pt, 20pt.
%Article
\documentclass[9pt]{extarticle}
%Report
\documentclass[14pt]{extreport}
[Changing the font size in LaTeX]
\fontsize{字體尺寸}{行距},只有使用\selectfont命令以後,\fontzize{}{}的設置才能生效。
\fontsize{10pt}{12pt}\selectfont 這樣後面的字體都變成10pt大小了。
點數(pt) 相應中文字號 控制命令
25 一號 \Huge
20 二號 \huge
17 三號 \LARGE
14 四號 \Large
12 小四號 \large
10 五號 \normalsize(default)
9 小五號 \small
8 六號 \footnotesize
7 小六號 \scriptsize
5 七號 \tiny
執行fc-list:lang=zh-cn命令查詢簡體中文的字體。同理查詢繁體中文字體能夠用fc-list:lang=zh-tw命令,查詢日語字體能夠用fc-list:lang=ja。
lz列出經常使用的幾個示例:
SimSun,宋體:style=Regular,常規
KaiTi,楷體:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standa
STXingkai,華文行楷:style=Regular
Microsoft YaHei,微軟雅黑,Microsoft YaHei Light,微軟雅黑 Light:style=Light,Regular
Microsoft YaHei,微軟雅黑:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
YouYuan,幼圓:style=Regular
FangSong,仿宋:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
SimHei,黑體:style=Regular,Normal,obyčejné,Standard,Κανονικά,Normaali,Normál,Normale,Standaard,Normalny,Обычный,Normálne,Navadno,Arrunta
NSimSun,新宋體:style=Regular,常規
/usr/share/fonts/方正蘭亭黑.TTF: FZLanTingHeiS\-R\-GB,方正蘭亭黑簡體:style=Regular
方式1
linux latex 中文不顯示
解決:使用xelatex編譯(不然可能直接報錯,而不是不顯示中文了)
且加入
\usepackage{fontspec}
\setmainfont{SimSun} %宋體
就能夠顯示中文了
方式2
%使用支持漢字的CJK包
\usepackage{CJK}
%開始CJK環境,只有在這句話以後,你才能使用漢字。另外,若是在Linux下,請將文件的編碼格式設置成GBK,不然會顯示亂碼。
\begin{CJK*}{GBK}{song}
加粗或加斜某幾個中文
使用\bf或者\textbf加粗中文無效果。
西文的習慣是使用加粗、傾斜、花體等來強調內容,而漢語的習慣則是使用不一樣的字形來強調內容。因此,通常的建議都是將粗宋體改用黑體,斜體之類的也改用仿宋、圓體之類的表示。
好比lz使用微軟雅黑代替中文加粗:\fontspec{Microsoft YaHei}\selectfont{求職意向:大數據算法工程師}
最好自定義一下:\newcommand{\yahei}[1]{\fontspec{Microsoft YaHei}\selectfont{#1}} 使用\yahei{求職意向:大數據算法工程師}
中文標題+中文正文+英文字體:
\RequirePackage{xeCJK} % 使用xeCJK宏包
\setCJKmainfont{方正蘭亭黑簡體} % 設置缺省中文字體
\setmainfont{Calibri} % 如不指定,使用Tex的默認英文字體
中文標題lz使用的是方正蘭亭粗黑簡體
使用包xeCJK後,隨時設置字體命令\fontspec會無效,要使用\CJKfontspec代替。
\part
\chapter
(report and book class only)
\section
\subsection
Note: \section*{Acknowledgments},標題不帶number
\subsubsection
\paragraph
\subparagraph
附錄appendix
The \appendix command changes the way following sectional unitsare numbered. The \appendix command itself generates no textand does not affect the numbering of parts. The normal use of thiscommand is something like
\chapter{A Chapter}
…
\appendix
\chapter{The First Appendix}
設置section字體爲微軟雅黑及其它設置說明
\newcommand{\yahei}[1]{\fontspec{Microsoft YaHei}\selectfont{#1}}
\titleformat{\section} % Customise the \section command
{\Large\scshape\raggedright\yahei} % Make the \section headers large (\Large),
% small capitals (\scshape) and left aligned (\raggedright)
{}{0em} % Can be used to give a prefix to all sections, like 'Section ...'
{} % Can be used to insert code before the heading
[\titlerule] % Inserts a horizontal line after the heading
\titlespacing*{\section}{0cm}{*1.8}{*1.8}
section可選參數
\section[short title]{long title}
• \label: Assign a symbolic name to a piece of text.
通常定義的方式最好以下:
ch
for chapters
sec
for lower-level sectioning commands
fig
for figures
tab
for tables
eq
for equations
• \pageref: Refer to a page number.
• \ref: Refer to a section, figure or similar.
對公式的引用建議使用\eqref,這樣會在公式引用自動添加()。
\label{stylefiles} #定義
?????? #引用
示例
多圖的插入
1 插入雙欄圖片時需在figure的上標中加入符號*
。雙列模式中的插圖:The starred form figure* is used when a document is in double-column mode (see \twocolumn). It produces a figure thatspans both columns, at the top of the page.這樣插圖佔兩列,而不是隻佔一列。
2 圖片插入的正確位置:初始引用頁面的最上或者最下位置。Like tables, figures cannot be split across pages; the best placement for them is typically the top or the bottom of the page nearest their initial cite.
3 關鍵性的語句是:\includegraphics[選項]{圖片.eps},其選項有:
height %指定圖片的高度
width %指定圖片的寬度 \includegraphics[width=3in]{file.eps} 將 file.eps 插入文檔而且它的寬度被縮放到 3 英寸,高度也會 按相應的比例縮放。若是用 \textwidth 或 \em 等的函數來 指定寬度,而不是用像 3 英寸這樣的固定尺寸,將會使你的 LATEX 文 檔更具通用性。例如:\includegraphics[width=\textwidth]{graphics.eps} 將所插入圖形縮放到和文本行的寬度同樣寬。width=0.8\textwidth 設置圖片爲0.8倍的文本寬度;width=\textwidth - 2.0in設置圖片爲文本寬度少2.0inches(當與 calc 宏包配合使用 時);
angle %指定圖片旋轉的角度 用graphicx包的includegraphics宏命令插入圖片時還可使圖片旋轉, 方法是 \includegraphics[height=高度][angle=旋轉角度]{圖片文件名}
scale %縮放圖形
trim 指定圖形能夠被看到的部分的另外一選項。所給出的四個數字 分別表明了從左、下、右、上被截去的值。正數表明今後方向 截去的大小,而負數則表明今後方向加上的大小。如\includegraphics[width=1\linewidth, trim=0 132 0 155]{./figures/framework0.eps}截取圖片上下的部分。lz一直沒搞清楚trim和clip使用,如\includegraphics[width=0.6\textwidth, clip=true, trim=98mm 40mm 88mm 35mm]{paper_organization.eps}顯示的並非想像的先截取eps文件中間的圖形,再放大爲0.6倍textwidth!![Displaying only part of an EPS picture]
其它選項[includegraphics 命令]
插入的圖形一般爲eps、pdf或者jpg、png等格式,假設名字叫fig,把它放在你的tex文檔同一目錄下。Note: 最佳的引用格式通常使用eps格式,若是使用pdflatex編譯,最好使用pdf格式圖片。.eps files to be displayable with LATEX. If you work with pdfL A TEX, use files in the .pdf format. Note that most modern TEX systems will convert .eps to .pdf for you on the fly. 若是是eps的圖形, 編譯過程是latex, dvips, ps2pdf. 若是是pdf jpg png圖形, 編譯過程是 pdflatex .
4 圖片描述/圖標題caption
若是想使用雙語描述,使用bicaption宏包:
\usepackage{bicaption}
\captionsetup[figure][bi-second]{name=Figure} %設置圖的英文編號前綴
\captionsetup[table][bi-second]{name=Table} %設置表的英文編號前綴
Note:也可使用ccaption 宏包,\usepackage{ccaption},將\caption命令換成以下:\bicaption{圖}{中文}{Fig}{English title},但這個宏包與caption宏包相互不兼容,很容易出錯。
5 圖標題和圖居中
\begin{figure}[!htbp]
\captionsetup{justification=centering} %圖標題強制居中
\centering %圖居中
\end{figure}
示例代碼
說明
在LaTeX文檔中插入圖片都是經過使用一些latex圖形處理宏命令來實現的, 有不少宏命令都支持在在LaTeX文檔中插入eps格式的圖形文件, 主要有:
用includegraphics宏命令(graphicx包)
首先需在latex文檔的文件說明部分加上:
\usepackage{graphicx}
而後在須要插入圖片的地方引用:
\includegraphics[height=高度]{圖片文件名} 或者: \includegraphics[width=寬度]{圖片文件名}
其中的"高度"和"寬度"是指但願圖片打印的高度和寬度, 必須給出單位, 可用釐米(cm)或英寸(in). 高度和寬度也可用上述格式同時給出, 這樣能夠改變原圖的長寬比例. 上述命令中的圖片文件名是指欲插入的圖片文件 的文件名, 圖片必需是eps格式的.(直接使用latex編譯不能插入jpg圖片,可是使用xelatex能夠)
一、先導言區加一句\usepackage{graphicx}
二、若是想插入inline的圖形, 直接使用
\includegraphics[width=5in]{fig},不用加後綴名。
三、若是你想插入浮動圖形, 使用
\begin{figure}[htbp]
\centering\includegraphics[width=3.5in]{fig}
\caption{something}
\label{fig:1}
\end{figure}
還有其它package插入的方法參考[LaTeX文檔插入圖片的幾種經常使用方法 ]
latex插圖的放置位置\begin{figure}[htbp]
圖形(figure)環境有一個可選參數項容許用戶來指示圖形有可能 被放置的位置。這一可選參數項能夠是下列字母的任意組合。
h 當前位置。 將圖形放置在 正文文本中給出該圖形環境的地方。若是本頁所剩的頁面不夠, 這一參數將不起做用。
t 頂部。 將圖形放置在頁面的頂部。
b 底部。 將圖形放置在頁面的底部 16.1。
p 浮動頁。 將圖形放置在一隻容許 有浮動對象的頁面上。
注:
若是在圖形環境中沒有給出上述任一參數,則缺省爲 [tbp]。
給出參數的順序不會影響到最後的結果。由於在考慮這些參數時 LATEX 老是嘗試以 h-t-b-p 的順序來肯定圖形的位置。因此 [hb] 和 [bh] 都使 LATEX 以 h-b 的順序來排版。
給出的參數越多, LATEX 的排版結果就會越好。 [htbp], [tbp], [htp], [tp] 這些組合獲得的效果不錯。
只給出單個的參數項極易引起問題16.2。 若是該圖形不適合所指定的位置,它就會被擱置並阻礙對後面的圖形 的處理。一旦這些阻塞的圖形數目超過了 18 幅這一 LATEX 所能允許 的最大值,就會產生 ``Too Many Unprocessed Floats'' 的錯誤(見 第 16.3 節)。
在浮動位置選項前加上一個驚歎號(如 \begin{figure}[!ht]) 會使 LATEX 忽略應用於文本頁的審美條件,試圖用最嚴格的標準來放置浮動圖形。不過, ! 不會影響應用於浮動頁的審美條件。
當 LATEX `` 試圖'' 放置一浮動圖形時, 它將遵循如下規則:
標準 LaTeX 提供有 array 和 tabular兩個製表環境,它們的完整格式以下:
or
這兩個環境的選項和參數定義是相同的,不過 array 主要用於數組矩陣的排版,且只能用在數學環境中,如equation 等。
array 宏包擴展了array 和 tabular環境功能,主要增長和加強了列樣式選項,甚至可編程定義新的列樣式;還增長了許多細部微調功能,如改變垂直表格線的粗細和自動調整表格間隙等。使用該宏包能夠排印出外形美觀、功能豐富的表格。
array
\begin{array}[pos]{cols}
column 1 entry &column 2 entry ... &column n entry \\
...
\end{array}
table的位置:通常初次引用頁的最上面。Because tables cannot be split across pages, the best placement for them is typically the top of the page nearest their initial cite.
To ensure this proper ``floating'' placement of tables, use the environment \textbf{table} to enclose the table's contents and the table caption. The contents of the table itself must go in the \textbf{tabular} environment, to be aligned properly in rows and columns, with the desired horizontal and vertical rules.
Note: 1 \caption放在主體下面時顯示也是在表格下面,放在主體上面就顯示在表格上面。
2 table*能夠橫跨兩頁面。
示例1(acm標準,三線圖)
示例2:另外一種三線圖的實現,lz以前用的,不過感受沒有acm標準那個好。
acm推薦使用的一個table格式包:booktabs
It is strongly recommended to use the package booktabs and follow its main principles of typography with respect to tables:
Never, ever use vertical rules.
Never use double rules.
It is also a good idea not to overuse horizontal rules.
參數
選項 | 說明 |
l |
該列左對齊排列 |
c |
該列居中排列 |
r |
該列右對齊排列 |
p{列寬} | 設置該列寬度,文本頂對齊。如須要哪一列自動換行,直接指定該列寬便可實現。(可是合併單元格後的就不會自動換行了,還沒解決這個問題) |
@{聲明} | 該列每行插入聲明中文本 |
m{列寬} | 設置該列寬度,文本居中對齊 |
b{列寬} | 設置該列寬度,文本底對齊 |
>{聲明} | 聲明能夠是命令或插入列元素以前的文本 |
<{聲明} | 聲明能夠是命令或插入列元素以後的文本 |
| | 列邊或列間加入一條垂直線 |
!{聲明} | 用聲明要求的樣式取代列間垂直線 |
*{num}{cols}
Equivalent to num copies of cols, where num is apositive integer and cols is a list of specifiers. Thus\begin{tabular}{|*{3}{l|r}|}
is equivalent to\begin{tabular}{|l|rl|rl|r|}
.
Note: 出錯Extra alignment tab has been changed to \cr是由於列數|c|c|...沒寫對。
使用makecell宏包來定製表格線,這個包提供了\Xhline來定製表格線。
\Xhline{1.2pt}
合併單元格
合併一行多列單元格
合併多行一列單元格
\begin{tabular}{|c|c|c|c|} \hline \multirow{2}*{合併兩行一列} & 二 & 三 & 四 \\ \cline{2-4} ~ & 2 & 3 & 4 \\ \hline \end{tabular}
合併多行多列單元格
description顧名思義,對列表項的解釋描述等,description項描述能夠是多個段落,也可多個環境嵌套。
\begin{description}
\item [first label] text of first item
\item [second label] text of second item
...
\end{description}
效果是首行不縮進,從第二行開始縮進。也能夠改變其表現[LaTeX技巧303:description列表不得不說的用法]。
有序列表 enumerate
有標號的縮進列表。\begin{enumerate}[itemindent=1em] %在這裏設置縮進的距離
\begin{enumerate}
\item [first label] text of first item
\item [second label] text of second item
...
\end{enumerate}
修改標號格式,如變成(1):
若是使用的是\usepackage{enumitem}則使用 \begin{enumerate}[itemsep=0pt, parsep=0pt,label=(\arabic*)]
列表標籤的控制指令有:
命令 | 例子 |
---|---|
\arabic | 1, 2, 3 ... |
\alph | a, b, c ... |
\Alph | A, B, C ... |
\roman | i, ii, iii ... |
\Roman | I, II, III ... |
\fnsymbol | 星號,單劍號,雙劍號等 |
若是使用的是\usepackage{enumerate}則使用 \begin{enumerate}[(1)]
使用混亂會出錯:
Undefined control sequence. \end{enumerate} OR
- Missing number, treated as zero.
\begin{itemize}
\item item1
\item item2
...
\end{itemize}
The itemize environment produces an 「unordered」, 「bulleted」list. Itemizations can be nested within one another, up to fourlevels deep. They can also be nested within other paragraph-makingenvironments, such as enumerate (see enumerate).
示例:
以上的列表環境空白較大,若是須要更緊湊的列表方式,能夠選用 mdwlist 宏包提供的 itemize*、enumerate* 和 description* 環境,用法和無星號的版本一致。
[在Latex使用條列式清單itemize , enumerate , description [轉]]
Note: 這個沒有研究過,感受可用於圖片插入,之後再研究。
8.20 引用quotation
and quote
\begin{quotation}
text
\end{quotation}
or
\begin{quote}
text
\end{quote}
使用BibTeX管理參考文獻
%% The file named.bst is a bibliography style file for BibTeX 0.99c
\bibliographystyle{named}
\bibliography{ijcai17}
ijcai17.bib內容:
@article{ gottlob:nonmon,
author = "Georg Gottlob",
title = "Complexity results for nonmonotonic logics",
journal = "Journal of Logic and Computation",
volume = "2",
number = "3",
pages = "397--425",
month = "June",
year = "1992"
}
Note: @article{ gottlob:nonmon...中的gottlob首字母必須小寫,不然引用能夠失敗。
簡寫
編寫bib文件時,若要使用一個簡寫來代替很長的字符串,可使用
@string(Abbrv="Long string")
好比: @string(TIT="IEEE Trans. Inf. Theory")
這樣在條目中,journal=TIT等價於journal={IEEE Trans. Inf. Theory}
注意使用簡寫的時候不要加大括號,大括號的做用是防止latex對內容作處理,好比在title中有些簡寫是須要大寫的,爲防止在參考文獻列表中把這些簡寫變成小寫字母,能夠在簡寫兩邊加上大括號。
正文中引用參考文獻 \cite[subcite]{keys}
The keys argument is a list of one or more citation keys, separated by commas. This command generates an in-text citation to the references associated with keys by entries in the .aux file. The text of the optional subcite argument appears after the citation. For example, \cite[p.~314]{knuth} might produce ‘[Knuth, p. 314]’.
\nocite: Include an item in the bibliography.The \nocite command produces no text, but writes keys,which is a list of one or more citation keys, to the .aux file.若要把沒引用的文檔列入參考文獻,用\nocite{}。\nocite{*}列入全部bib文件中的文獻。\nocite{*}命令是寫在.tex文件中而不是.bib文件。
Note: key通常取一做的姓和標題的一個詞。The key is a short reference you invent to uniquely identify each work; in this sample document, the key is the first author's surname and a word from the title.
示例
Gottlob~\shortcite{gottlob:nonmon} has shown that, rather than, In our previous work~\cite{gottlob:nonmon}
Gottlob [1992] has shown that, rather than, In our previous work [Gottlob, 1992]
單做:[Gottlob, 1992] 或者Nebel [2000](很容易看出來時)
二做:[Brachman and Schmolze, 1985]
多做:[Baumgartner et al., 2001]
多篇引用使用,隔開:[Gott-
lob et al., 2002; Levesque, 1984a]
latex代碼:\cite{gls:hypertrees,levesque:functional-foundations}
引用做者\citeauthor
如同時引用做者和文獻 Early,~\citeauthor{eagle2009inferring}~\cite{eagle2009inferring} examined the communications
結果Early, Eagle et al. [6] examined the communications
注意\citeauthor是由包\usepackage{natbib}提供,不然出錯。
其它包中添加這種行爲:
\documentclass{article} \usepackage{natbib} \begin{document} \citeauthor{lamport94} \citet{lamport94} \begin{thebibliography}{9} \bibitem[Lamport (1994)]{lamport94}Leslie Lamport, \emph{\LaTeX: A Document Preparation System}. Addison Wesley, Massachusetts, 2nd Edition, 1994. \end{thebibliography} \end{document}
[Problem displaying author in citation when using natbib's \citeauthor command]
\footnote
\footnote[number]{text}
LaTeX 提供了 \pagestyle 命令讓咱們能夠文檔全部頁面的樣式 (包括頁邊距, 頁眉和頁腳等內容); 同時, 還提供了 \pagenumbering 來設置頁碼的顯示格式. LaTeX 提供了四種不一樣的頁面樣式:
設置沒有頁眉,頁腳居中顯示自定義字符串
\usepackage{fancyhdr}
\renewcommand{\headrulewidth}{0.0pt} #去除頁眉的橫線bar
\pagestyle{fancy}
\fancyhf{} %\fancyhead{} #去除頁眉內容
\cfoot{Passion in my heart, Dynamic in my body!} #設置頁腳居中字符串
[How to remove the top horizontal bar in fancyhdr?]
\newcommand and \renewcommand define and redefine a command, respectively.
使用\newcommand能夠本身定製命令
語法格式 \newcommand{\yourcommand}[參數個數]{內容}
好比:\newcommand{\wuhao}{\fontsize{10.5pt}{10.5pt}\selectfont}用來定義一個選定字號命令
Here’s a command definition that uses arguments:
\newcommand{\defreference}[1]{Definition~??????}
Then, \defreference{def:basis} will expand to something like ‘Definition~3.14’.
\newcommand示例
\newcommand{\home}[2][]{\faHome\
\ifthenelse{\isempty{#1}}
{\href{#2}{#2}}
{\href{#2}{#1}}}
使用\home[***.github.io]{http://***.github.io/}
pdf效果點擊就能夠跳轉
不過lz沒有搞懂[2][]的用法,知道的麻煩給個連接吧?好比如何定義4個參數的兩個不一樣連接?
Note: \href{網址}{描述}:生成網址連接,以正常字體顯示描述,隱藏網址。
因此能夠簡單的使用\href{http://blog.csdn.net/pipisorry}{blog.csdn.net/pipisorry}來表示上面的連接。可是如何定義4個參數的兩個不一樣連接?
[How to use \newcommand for \href?]
\usepackage[colorlinks,
linkcolor=red,
anchorcolor=blue,
citecolor=green
]{hyperref}
Define a new theorem-like environment. Synopses:
\newtheorem{name}{title}[numbered_within]
\newtheorem{name}[numbered_like]{title}
\newtheorem{定理環境名}{標題}[主計數器名]
%例如
\newtheorem{theorem}{Theorem}[Chapter]
示例
\newtheorem{problem}{Problem}
示例1(lz都是使用這個來定義的!)
示例2:定義\newdef
\newdef{definition3}{Definition}
Note: lz也不知道\newdef是什麼意思。。。
• \indent: | Indent this paragraph. | |
• \noindent: | Do not indent this paragraph. Latex 換行頂格、不縮進 | |
• \parskip: | Space added before paragraphs. | |
• Marginal notes: | Putting remarks in the margin. |
經常使用數學符號的LaTeX 表示方法,數學符號表,請參考[WiKibook Mathematics][symbols] [unofficial reference manual16.2]
在Latex 中怎樣在指向左或右的箭頭上方標註字母?
宏包amsmath 提供了兩個能夠伸長的單箭頭符號
\xleftarrow[下方公式]{上方公式}
上方可輸入中文的雙向箭頭
雙向箭頭,且上方可輸入中文,且箭頭居中。
\usepackage{extarrows},$\xleftrightarrow{\text{社交聯繫}}$
或者$\stackrel{\underleftrightarrow{\text{社交聯繫}}}{}$,其中\stackrel{上層符號}{下層符號}表示將任意兩個符號重疊在一塊兒。
可使用\left和\right來顯示不一樣的括號:
功能 | 語法 | 顯示 |
---|---|---|
圓括號,小括號 | \left( \frac{a}{b}\right) | ![]() |
方括號,中括號 | \left[ \frac{a}{b}\right] | ![]() |
花括號,大括號 | \left\{ \frac{a}{b}\right\} | ![]() |
角括號 | \left \langle \frac{a}{b} \right\rangle | ![]() |
單豎線,絕對值 | \left| \frac{a}{b}\right| | ![]() |
雙豎線,範 | \left \| \frac{a}{b} \right\| | ![]() |
取整函數 (Floor function) |
\left \lfloor \frac{a}{b} \right\rfloor | ![]() |
取頂函數 (Ceiling function) |
\left \lceil \frac{c}{d} \right\rceil | ![]() |
斜線與反斜線 | \left / \frac{a}{b} \right\backslash | ![]() |
上下箭頭 | \left \uparrow \frac{a}{b} \right\downarrow | ![]() |
\left \Uparrow \frac{a}{b} \right\Downarrow | ![]() |
|
\left \updownarrow \frac{a}{b} \right\Updownarrow | ![]() |
|
混合括號 | \left [ 0,1 \right ) \left \langle \psi \right | |
![]() ![]() |
單左括號 | \left \{ \frac{a}{b} \right . | ![]() |
單右括號 | \left . \frac{a}{b} \right \} | ![]() |
備註:可使用\big, \Big, \bigg,\Bigg控制括號的大小,好比代碼\Bigg (\bigg [ \Big \{\big \langle \left | \| \frac{a}{b} \| \right |\big \rangle \Big \}\bigg ] \Bigg )顯示
LATEX 使用一種特殊的模式來排版數學符號和公式(mathematics)。段落中的數學表達式應該置於和和,$ 和$ 或者
之間。對於較大的數學式子,最好的方法是使用顯示式樣來排版:將它們放置於
或
之間。這樣排版出的公式是沒有編號的。若是你但願LATEX 對其添加編號的話,可使用equation 環境來達到這一目的。
數學模式和文本模式有不少不一樣之處。例如在數學模式中:空格和分行都將被忽略。全部的空格或是由數學表達式邏輯的衍生,或是由特殊的命令如\,,\quad 或\qquad 來獲得。在數學環境中($........$ 和
)生成空格請參考19 空格spaces。
不容許有空行,每一個公式中只能有一個段落。每一個字符都將被看做是一個變量名並以此來排版。若是你但願在公式中出現普通的文本(使用正體字並能夠有空格),那麼你必須使用命令\textrm{...} 來輸入這些文本。數學模式中的命令僅對其後面第一個字符起做用。因此,若是你但願某一命令做用於多個字符的話,那麼你就必須將它們放置於括號中:{...}。
。。。
小公式,lz通常使用$$環境實現。大公式,lz通常使用equation環境實現。
無numberd公式環境
有numbered公式環境:equation環境
\begin{equation}
math text
\end{equation}
Make a displaymath
environment (see displaymath) with anequation number in the right margin. The equation number is generated using the equation
counter.
示例
引用時候使用Eq. ??????
長公式
不對齊
無須對齊的長公式可使用 multline
環境。
效果:
若是不須要編號,可使用 multline*
環境代替。
對齊
須要對齊的公式,可使用 alig
ned 次環境來實現,它必須包含在數學環境以內。
效果圖:
&爲對齊指示符,這個是經常使用的。
固然也可使用下面這個進行長公式分行左對齊
無需對齊的公式組可使用 gather
環境,須要對齊的公式組可使用 align
環境。他們都帶有編號,若是不須要編號可使用帶星花的版本。
效果:
Latex中將下標放在正下方
Latex輸入數學公式時(特別是文字之間的公式),有時須要將公式的下標放在正下方。好比Max函數下面的取值範圍,須要放在Max的正下方。
方法1
$\max \limits_{a<x<b}\{f(x)\}$
可是對於雙$$之間的公式,Latex默認下標是放在正下方。因此就不須要加\limits。此方法在equation環境中一樣適用。
方法2
\usepackage{amsmath}
格式
\underset{下標}{表達式}
\underset{t}{\text{maxk}} \{
Note: 公式中不能直接寫入自定義的maxk這些字符,要使用\text{maxk},不然會變成這樣。另外若是latex自帶的字符如max應該直接使用\max。
• \maketitle: Generate a title page.
• \pagenumbering: Set the style used for page numbers.
• \pagestyle: Change the headings/footings style.
• \thispagestyle: Change the headings/footings style for this page.
\author{name \and name2}
The \author command declares the document author(s), where the argument is a list of authors separated by \and commands. Use \\ to separate lines within a single author’s entry—for example, to give the author’s institution or address.
\date{text}
The \date command declares text to be the document’s date. With no \date command, the current date (see \today) is used.
\thanks{text}
The \thanks command produces a \footnote to the title, usually used for credit acknowledgements.
\title{text}
The \title command declares text to be the title of the document. Use \\ to force a line break, as usual.
Horizontal space
• \hspace: Fixed horizontal space.
• \hfill: Stretchable horizontal space.
• \(SPACE) and \@: Space after a period.
• \(SPACE) after CS: Controlling space gobbling after a control sequence.
• \frenchspacing: Make interword and intersentence space equal.
• \thinspace: One-sixth of an em.
• \/: Insert italic correction.
• \hrulefill \dotfill: Stretchable horizontal rule or dots.
Vertical space
• \addvspace: Add arbitrary vertical space if needed.
• \bigskip \medskip \smallskip: Fixed vertical spaces.
• \vfill: Infinitely stretchable vertical space.
• \vspace: Add arbitrary vertical space.
行縮進2字符:使用\hspace{2em} #\indent好像無效不知爲啥
因爲LaTeX 採用的是源文件編譯方式, 默認LaTeX會忽略多餘的空格。
若是須要產生一個空格,可使用 命令\ , 注意表明的是空間鍵。例如: Jones, et al.\ (1993), 這樣就在 "."後產生了一個空格。符號~產生一個不可斷行的空格。即空格前的反斜線符號產生一個不能伸長的空格。波浪字符‘~’ 也產生一個不能伸長的空格,而且禁止斷行。
若是須要多個空格, 可使用多個\. 一個更方便生成水平方向的空格可使用命令\hspace{ 長度 } , 例如 \hspace{1cm},若是\hspace命令在一行的開始則須要改用\hspace*{1cm}來產生空格;若是要產生垂直方向的空白, 可以使用命令\vspace{ 長度 } 和 \vspace*{ 長度 }。
若是想在段落直接產生必定的間距, 則使用命令\medskip, \bigskip, 或 \smallskip.
爲了使輸出的右邊界對齊,LATEX在單詞間插入不等的間隔。在句子的末尾插入的空間稍多一些,由於這使得文本更具可讀性。LATEX假定句子以句號、問號或驚歎號結尾。若是句號緊跟一個大寫字母,它就不視爲句子的結尾。由於通常在有縮寫地方,纔出現句號緊跟大寫字母的狀況。
句號前的命令\@ 說明這個句號是句子的末尾,即便它緊跟一個大寫字母。對article風格的文檔,有下列分節命令:\section{...} \paragraph{...} \subsection{...}\subparagraph{...} \subsubsection{...} 對report 和book 風格的文檔,還有其餘兩個分節命令:\part{...} \chapter{...}。由於article風格的文檔不劃分爲章,因此很容易把它做爲一章插入書籍文檔中。節之間的間隔,節的序號和標題的字號由LATEX 自動設置。分節的兩個命令有些特殊性:命令\part 不影響章的序號。命令\appendix 不帶參量,只把章的序號改用爲字母標記。LATEX在文檔編譯的最後一個循環中,提取節的標題和頁碼以生成目錄。命令\tableofcontents在其出現的位置插入目錄。爲了獲得正確的目錄內容,一個新文檔必須編譯兩次。上面列出的分節命令也以「帶星」的形式出現。「帶星」的命令經過在命令名稱後加*來實現。它們生成的節標題既不出現於目錄,也不帶序號。例如,命令\section{Help} 的「帶星」形式爲\section*{Help}。目錄出現的標題,通常與輸入的文本徹底一致。有時這是不可能的,由於標題太長排不進目錄。在這種狀況下,目錄的條目可由真實標題前的可選參量肯定。
\chapter[Title for the table ofcontents]{A long and especially boring title, shown inthe text}
整篇文檔的標題由命令\maketitle產生。標題的內容必須在調用\maketitle 之前,由命令\title{...}, \author{...} 和可選的\date{...}定義。在命令\author 中,能夠輸入幾個用\and 命令分開的名字。\frontmatter 應接着命令\begin{document}使用。它把頁碼更換爲羅馬數字。對於正文前的內容廣泛使用帶星的命令(例如,\chapter*{Preface}),以阻止LATEX 對它們排序。\mainmatter應出如今書的第一章緊前面。它打開阿拉伯頁碼計數器,並對頁碼重新計數。\appendix 標誌書中附錄材料的開始。該命令後的各章序號改用字母標記。\backmatter應該插入與書中最後一部份內容的緊前面,如參考文獻和索引。在標準文檔類型中,它對頁面沒有什麼效果。
兩個quad空格 a \qquad b 兩個m的寬度
quad空格 a \quad b 一個m的寬度
大空格 a\ b 1/3m寬度
中等空格 a\;b 2/7m寬度
小空格 a\,b 1/6m寬度
緊貼 a\!b 縮進1/6m寬度
• Reserved characters: Inserting ‘# $ % & ~ _ ^ \ { }’
如何打出這些特殊字符? \ 使用\backslash,~使用\sim,{使用\{等等。latex雙引號``word'' [函數、符號及特殊字符][http://zh.wikipedia.org/wiki/Help:MATH]
• Text symbols: Inserting other non-letter symbols in text.
• Accents: Inserting accents.
• Non-English characters: Inserting other non-English characters.
• \rule: Inserting lines and rectangles.
• \today: Inserting today’s date.
\LaTeX
The LaTeX logo.
使用時後面要加一個{},不然空格會被忽略。somewords \LaTeX{} somewords.還能夠這樣使用:{\LaTeX{} and Word Style Files}。
在做者名字上加不一樣角標
[lshort-zh-cn.pdf]
\ldots
\dots
\textellipsis
An ellipsis (three dots at the baseline): ‘…’. \ldots and \dots also work in math mode.
latex下描寫算法的包主要有algorithmic, algorithmicx。這兩個宏包是被設計成同時一塊兒使用的,但也能夠根據用戶的特殊須要分開使用。其中 algorithm 宏包主要是爲算法提供一個浮動體環境,也就是說,在 LaTeX 中算法和圖像,表同樣,都是浮動體。algorithmic 宏包主要是用來完成算法的描述功能,該宏包提供了咱們描述算法經常使用的幾種結構命令,如條件結構、循環結構等。下面咱們就經過示例來對 algorithm 的使用進行講解。
Algorithmic 宏包,爲描述算法提供了程序設計中的全部經常使用結構的表示,如:判斷 (IF) ,循環 (WHILE, FOR, LOOP), 輸入(REQUIRE) ,輸出(ENSURE)等。
Algorithm 環境主要做用是將代碼段變成浮動體,浮動體一方面能防止代碼超出頁面範圍,另一方面也方面最後生成和圖表目錄類似的算法列表目錄。也能經過標記,方便在文章其它地方引用。
簡單示例
\usepackage{algorithm}
\usepackage{algorithmicx}
\floatname{algorithm}{算法}
\renewcommand{\algorithmicrequire}{\textbf{輸入:}}
\renewcommand{\algorithmicensure}{\textbf{輸出:}}
[LaTeX/Algorithms 僞代碼] [Latex 創建帶有豎線和編號的算法環境]
(如用在p{列寬}中)
絕對定位則是固定尺寸,它們採用的是物理度量單位:cm、mm、in、px、pt以及pc。
但在實際應用中,咱們使用最普遍的則是em、rem、px以及百分比(%)來度量頁面元素的尺寸。
長度的說明:
定義 \def\FRAMEWORK{online-offline unified framework}
引用 we introduce the {\it \FRAMEWORK}~ which can
[TeX 的宏]
文件名 {\tt ijcai17.sty}
連接名 {\tt http://www.ijcai-17.org/}
not強調 {\em not}
問題:
bib文件中的{Lixto}表明什麼意思?
from: http://blog.csdn.net/pipisorry/article/details/54571521
ref: [A simple guide to LaTeX]
[使用LaTex寫畢業論][一份其實很短的 LaTeX 入門文檔][始終:LaTeX 分類][lshort: http://ctan.mirror.rafal.ca/info/lshort/english/lshort.pdf]*
[LATEX與論文寫做]*
[Ctex社區:LaTeX 文檔 [LaTeX 2e 插圖指南(中文)]
[LaTeX Tutorials: A Primer http://www.tug.org/twg/mactex/tutorials/ltxprimer-1.0.pdf]
[LaTeX Beginner's Guide]
[texstudio help: LaTeX2e unofficial reference manual (October 2015)]*
[lshort-zh-cn.pdf]
[LaTeX簡介:入門文檔 huangxg 的 LaTeX Notes]
[ChinaTeX 論壇: 論壇 - ChinaTeX論壇]
[wikipedia en.wikibooks.org/wiki/LaTeX/Absolute_Beginners]