使用 EasyLaTeX 寫論文:從新增專案到匯出 PDF

說明中心EasyLaTeX 官方發布日期

本教學用一份梯度下降主題的短文示例,演示在 EasyLaTeX 中組織標題、摘要、章節、公式、圖表和參考文獻。示例用於學習寫作流程,正式論文仍需自己的研究內容和投稿模板。

1. 新增專案並設定主檔案

登入 EasyLaTeX 編輯器,新增空專案,開啟或建立 main.tex。在頂部「選擇編譯主檔案」處選中它;在左側「編輯器設定」的「編譯器」中選擇 XeLaTeX。編譯器按使用者在當前專案中的選擇儲存,協作者也應檢查自己的設定。

檔案樹管理資源,中間區域編輯原始碼,輸出面板顯示 PDF。圖中是英文介面的示例:

2. 設定導言區

把下面的導言區放在檔案開頭。它還不是完整文件,後面需要正文的開始與結束指令:

LaTeX
\documentclass[UTF8,a4paper,11pt]{ctexart}\ctexset{contentsname={目錄},listfigurename={插圖目錄},listtablename={表格目錄},figurename={圖},tablename={表}}\usepackage{amsmath,amssymb}\usepackage{graphicx}\usepackage{booktabs}\usepackage[a4paper,margin=1in]{geometry}\usepackage[numbers]{natbib}\usepackage{hyperref}\title{Gradient Descent: A Writing Example}\author{Your Name}\date{\today}

中文示例使用 ctexart;英文通常可用 article。有學校或期刊模板時保留其文件類和要求,不把整段導言區直接覆蓋到現成模板上。

3. 寫標題、摘要與章節

導言區之後寫一次 \begin{document},再寫 \maketitle 和摘要。整個檔案最後只保留一個對應的 \end{document}。

LaTeX
\begin{abstract}This document demonstrates the structure of a short paper on gradient descent.It includes notation, an update equation, an illustrative comparison table,an optional figure, and references.\end{abstract}

在同一個正文內繼續加入章節骨架:

LaTeX
\section{Introduction}\section{Mathematical Fundamentals}\subsection{Gradient and Update Rule}\section{Gradient Descent Variants}\section{Learning Rate}\section{Conclusion}

標題與章節編號由文件類管理。下面的片段都放在正文中,不要再重複新增文件類或正文邊界。文末有完整合並示例。

4. 加入公式

短公式放在 \(...\) 中;不編號的獨立公式用 \[...\]。需要編號和引用時用 equation、\label 與 \eqref:

LaTeX
\begin{equation}  \theta_{t+1}=\theta_t-\eta\nabla J(\theta_t)  \label{eq:update}\end{equation}Equation~\eqref{eq:update} defines the update used here.

多行推導用 align,以 & 對齊,\\ 換行:

LaTeX
\begin{align}J(\theta_0,\theta_1)  &=\frac{1}{2m}\sum_{i=1}^{m}(h_{\theta}(x_i)-y_i)^2,\\\frac{\partial J}{\partial\theta_0}  &=\frac{1}{m}\sum_{i=1}^{m}(h_{\theta}(x_i)-y_i).\end{align}

5. 加入表格

table 管理浮動與表題,tabular 排列單元格;示例中的比較是概念性說明,不是實驗測量:

LaTeX
\begin{table}[tbp]\centering\caption{Illustrative comparison of gradient estimates}\label{tab:variants}\begin{tabular}{lll}\topruleVariant & Samples per update & Typical sampling fluctuation \\\midruleBatch & Full dataset & No mini-batch sampling \\Stochastic & One example & Higher \\Mini-batch & A selected batch & Between the two \\\bottomrule\end{tabular}\end{table}

列之間用 & 分隔。把 \label 放在 \caption 後,正文用 \ref{tab:variants} 引用。

6. 上傳並引用圖片

透過檔案樹上傳 loss-curve.png。下面的例子在圖片缺失時顯示佔位框,上傳真實曲線後自動使用圖片:

LaTeX
\begin{figure}[tbp]\centering\IfFileExists{loss-curve.png}{%  \includegraphics[width=0.7\linewidth]{loss-curve.png}%}{%  \fbox{\rule{0pt}{30mm}\rule{0.65\linewidth}{0pt}}%}\caption{Loss-curve illustration; replace with your own figure}\label{fig:loss}\end{figure}

graphicx 提供插圖指令,相對寬度隨可用行寬調整。檔案路徑與大小寫必須對應;不要把佔位框當作已完成的研究圖。

7. 加入參考文獻

少量文獻可用 thebibliography。正文透過 \cite{goodfellow2016} 引用;這種方式不用 .bib 或外部文獻處理程式,但引用仍可能需要平台執行重複編譯:

LaTeX
\begin{thebibliography}{9}\bibitem{goodfellow2016} Ian Goodfellow, Yoshua Bengio, and Aaron Courville.\emph{Deep Learning}. MIT Press, 2016.\bibitem{bottou2012} Leon Bottou.Stochastic Gradient Descent Tricks. In \emph{Neural Networks: Tricks of the Trade}, 2012.\bibitem{kingma2015} Diederik P. Kingma and Jimmy Ba.Adam: A Method for Stochastic Optimization. ICLR, 2015.\end{thebibliography}

需要重複使用文獻庫或換樣式時,參閱 BibTeX 與 biblatex 教學。

8. 編譯、檢查並下載

點選編譯後,當前編輯內容會先儲存。等待本次任務結束,再檢查公式、圖表、引用和 PDF。出錯時開啟「Bug」檢視錯誤與「原始日誌」,必要時使用「AI 修復」。具體流程見 編譯排錯。

工具欄下載選單中的「下載 PDF 檔案」用於最終閱讀和提交,「下載 LaTeX 專案」用於儲存原始碼與資源。確認編譯成功後再下載 PDF:

完整的 main.tex

以下是一份可獨立使用的結構示例;圖片未上傳時會顯示佔位框。複製時用它替換測試專案的主檔案,不要接在已有的 \end{document} 後面:

LaTeX
\documentclass[UTF8,a4paper,11pt]{ctexart}\ctexset{contentsname={目錄},listfigurename={插圖目錄},listtablename={表格目錄},figurename={圖},tablename={表}}\usepackage{amsmath,amssymb}\usepackage{graphicx}\usepackage{booktabs}\usepackage[a4paper,margin=1in]{geometry}\usepackage[numbers]{natbib}\usepackage{hyperref}\title{Gradient Descent: A Writing Example}\author{Your Name}\date{\today}\begin{document}\maketitle\begin{abstract}This document demonstrates the structure of a short paper on gradient descent.It includes notation, an update equation, an illustrative comparison table,an optional figure, and references.\end{abstract}\section{Introduction}Background is discussed in~\cite{goodfellow2016,bottou2012,kingma2015}.\section{Mathematical Fundamentals}Let $J$ be a differentiable objective and $\eta>0$ a step size.\begin{equation}  \theta_{t+1}=\theta_t-\eta\nabla J(\theta_t)  \label{eq:update}\end{equation}Equation~\eqref{eq:update} defines the update used here.\begin{align}J(\theta_0,\theta_1)  &=\frac{1}{2m}\sum_{i=1}^{m}(h_{\theta}(x_i)-y_i)^2,\\\frac{\partial J}{\partial\theta_0}  &=\frac{1}{m}\sum_{i=1}^{m}(h_{\theta}(x_i)-y_i).\end{align}\section{Gradient Descent Variants}\begin{table}[tbp]\centering\caption{Illustrative comparison of gradient estimates}\label{tab:variants}\begin{tabular}{lll}\topruleVariant & Samples per update & Typical sampling fluctuation \\\midruleBatch & Full dataset & No mini-batch sampling \\Stochastic & One example & Higher \\Mini-batch & A selected batch & Between the two \\\bottomrule\end{tabular}\end{table}Table~\ref{tab:variants} is a qualitative illustration, not measured performance.\section{Learning Rate}Upload your own loss-curve image to replace the placeholder in Figure~\ref{fig:loss}.\begin{figure}[tbp]\centering\IfFileExists{loss-curve.png}{%  \includegraphics[width=0.7\linewidth]{loss-curve.png}%}{%  \fbox{\rule{0pt}{30mm}\rule{0.65\linewidth}{0pt}}%}\caption{Loss-curve illustration; replace with your own figure}\label{fig:loss}\end{figure}\section{Conclusion}Check the assumptions, results, and references for your actual paper.\begin{thebibliography}{9}\bibitem{goodfellow2016} Ian Goodfellow, Yoshua Bengio, and Aaron Courville.\emph{Deep Learning}. MIT Press, 2016.\bibitem{bottou2012} Leon Bottou.Stochastic Gradient Descent Tricks. In \emph{Neural Networks: Tricks of the Trade}, 2012.\bibitem{kingma2015} Diederik P. Kingma and Jimmy Ba.Adam: A Method for Stochastic Optimization. ICLR, 2015.\end{thebibliography}\end{document}

下一步用自己的論證、資料和圖表替換示例內容,並按學校或期刊的模板檢查格式。