LaTeX(LATEX,音譯「拉泰赫」)是一種基於ΤΕΧ的排版系統,由美國計算機學家萊斯利·蘭伯特(Leslie Lamport)在20世紀80年代初期開發,利用這種格式,即便使用者沒有排版和程序設計的知識也能夠充分發揮由TeX所提供的強大功能,能在幾天,甚至幾小時內生成不少具備書籍質量的印刷品。對於生成複雜表格和數學公式,這一點表現得尤其突出。所以它很是適用於生成高印刷質量的科技和數學類文檔。這個系統一樣適用於生成從簡單的信件到完整書籍的全部其餘種類的文檔。api
博主使用LaTeX主要是用來寫做美國數學建模競賽的論文,去年的美賽咱們使用word進行排版,有不少玄學格式問題,今年的美賽還有幾天時間,準備突擊學習一下LaTeX,記錄下學習過程,與各位LaTeX初學者交流、共同進步。編輯器
注:使用環境爲macOS Sierra系統工具
使用LaTeX以前須要作兩件事:一是安裝、配置好一個 TeX 發行版;二是選擇一個順手的編輯器(和 PDF 閱讀器)。學習
在macOS上,主流的Tex髮型版是MacTex,安裝簡單方便,下載連接:http://tug.org/mactex/spa
下載好MacTex後,自帶一個編輯器:TexShop,基本能夠知足大部分場景的使用。這裏筆者認爲新手使用自帶的編輯器已經足夠了,不須要額外下載別的編輯器。設計
至此,關於Tex工具的安裝及配置已經完成。code
打開TexShop,複製如下代碼粘貼到編輯區內,點擊左上角「排版」按鈕,便可生成第一個由LaTeX編輯的PDF文件!orm
\documentclass{article}
\begin{document}
hello, world
\end{document}
創建一個新文檔,將如下內容複製進入文檔中,保存,保存類型選擇爲 UTF-8, 編譯並觀察現象。blog
\documentclass{article} \author{My Name} \title{The Title} \begin{document} \maketitle hello, world % This is comment \end{document}
%爲本行右邊全部內容被註釋掉,在生成的 pdf 中不會顯示。 教程
相似與以前介紹的標題和做者的輸入,其餘內容的編輯也是由相似"\****"之類的指令完成的 。
創建一個新文檔,將如下內容複製進入文檔中,保存,保存類型選擇爲 UTF-8, 編譯並觀察現象。
\documentclass{article} \title{Hello World} \begin{document} \maketitle \section{Hello China} China is in East Asia. \subsection{Hello Beijing} Beijing is the 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 Tian'anmen Square \subsection{Hello Guangzhou} \paragraph{Sun Yat-sen University} is the best university in Guangzhou. \end{document}
"section"即章節的標記,在section前加一個"sub"前綴表示章節的子章節,若是加兩個"sub",表示子章節的子章節,以此類推。"paragraph"與"subparagraph"爲段落表示,與section使用相似。
在\section以前的一行加入"\tableofcontents",便可生成目錄。如:
\documentclass{article} \begin{document} \tableofcontents \section{Hello China} China is in East Asia. \subsection{Hello Beijing} Beijing is the capital of China. \subsubsection{Hello Dongcheng District} \paragraph{Hello Tian'anmen Square}is in the center of Beijing \subparagraph{Hello Chairman Mao} is in the center of Tian'anmen Square \end{document}
在代碼中,空一行表示另起一段,\\爲段內強制換行
在 LaTeX入門教程(二)中,會繼續介紹LaTeX中公式、圖片、圖表的插入。