我使用的是LyX+TeXLive。
LyX界面直覺,類似于Word。可以把精力更多集中在内容,而不是在代碼上。
TeXLive庫齊全。
安裝
- 安裝TeXLive
Index of /tex-archive/systems/texlive/Imagesmirror.las.iastate.edu
texlive2019-20190410.iso (~3.3G)
輕按兩下打開iso,加載到虛拟光驅。運作install-tl-advanced.bat,按提示安裝。
2. 安裝LyXhttps://www.lyx.org/Downloadwww.lyx.org
安裝Installer,即LyX-2352-Installer-4.exe (~58 MB)
latex.exe選擇TexLive latex.exe所在檔案夾
3. 配置中文環境運作LyX,文檔→首選項
- 文檔類:Chinese Article (CTex)
- 語言:中文(繁體),檔案編碼:Unicode(XeTeX)(utf8)
- Formats 輸出格式 PDF(XeTeX)
LyX自帶拼寫檢查:工具→首選項→語言設定,拼寫檢查器,勾選spellcheck continuously。切換拼寫檢查預設語言:文檔→首選項→語言 。拼寫檢查擴充詞庫
https://wiki.lyx.org/Windows/SpellCheckerwiki.lyx.org
4. EnjoyNote
1. TeXLive必要宏包documentclass{article}
usepackage{ctex}
usepackage[namelimits]{amsmath}
usepackage{amssymb}
usepackage{amsfonts}
usepackage{mathrsfs}
usepackage{algpseudocode,algorithm,algorithmicx}
2. 論文模闆TeXLive自帶大量宏包,比如prl的RevTeX,直接調用即可,但仍推薦去官網下載下傳完整版,可參考其模闆改寫。編譯格式為pdfLaTeX,需要将LyX檔案導出為tex(pdfLaTeX)格式
https://journals.aps.org/revtexjournals.aps.org
3. 數學符号數學公式用$ $包覆
常用數學符号:
- <= leq 或 le
- >= geq 或 ge
- << ll
- >> gg
- ≠ neq 或者 ne
- ∈ in
- 不屬于 notin
- × times
- ± pm
http://mohu.org/info/symbols/symbols.htmmohu.org https://blog.csdn.net/gsww404/article/details/78684278blog.csdn.net
4. 算法模闆使用algorithmicx宏包生成僞代碼算法圖
完整教程:
http://tug.ctan.org/macros/latex/contrib/algorithmicx/algorithmicx.pdftug.ctan.org
4.1 第一例在TeXworks中使用pdfLaTeX或XeLaTeX執行編譯,編譯效果:
documentclass{article}
usepackage{algpseudocode,algorithm,algorithmicx}
newcommand*DNA{textsc{dna}}
newcommand*Let[2]{State #1 $gets$ #2}
algrenewcommandalgorithmicrequire{textbf{Precondition:}}
algrenewcommandalgorithmicensure{textbf{Postcondition:}}
begin{document}
begin{algorithm}
caption{Counting mismatches between two packed DNA{} strings
label{alg:packed-dna-hamming}}
begin{algorithmic}[1]
Require{$x$ and $y$ are packed DNA{} strings of equal length $n$}
Statex
Function{Distance}{$x, y$}
Let{$z$}{$x oplus y$} Comment{$oplus$: bitwise exclusive-or}
Let{$delta$}{$0$}
For{$i gets 1 textrm{ to } n$}
If{$z_i neq 0$}
Let{$delta$}{$delta + 1$}
EndIf
EndFor
State Return{$delta$}
EndFunction
end{algorithmic}
end{algorithm}
end{document}
以上來源自Sam Estep的回答:
https://tex.stackexchange.com/questions/1375/what-is-a-good-package-for-displaying-algorithmstex.stackexchange.com
注1:可利用以下代碼實作
Input/Outputalgrenewcommandalgorithmicrequire{textbf{Input:}}
algrenewcommandalgorithmicensure{textbf{Output:}}
注2:可使用State、Statex實作代碼帶編号/不帶編号換行。
4.2 第二例在TeXworks中使用pdfLaTeX或XeLaTeX執行編譯,編譯效果:
documentclass{article}
usepackage{algorithm} % float wrapper for algorithms.
usepackage{algpseudocode} % layout for algorithmicx
usepackage{amsmath} % AMS mathematical facilities for LATEX
% Nice looking for empty set
usepackage{amssymb} % provides an extended symbol collection
letoldemptysetemptyset
letemptysetvarnothing
begin{document}
% algorithm
begin{algorithm}
begin{algorithmic}%[1]
caption{CDS with betweenness centrality} label{algorithm: cds bw}
Require A connected graph $G(V, E)$
State $d gets {v : bw(v)}, v in V$, sort by BW on ascending order
State $V' gets emptyset$, connected dominating sets
ForAll{$v$ : $bw(v), v notin V'$}
If{$bw(v) = 0$ OR $G(V-{v})$ is connected}
State $V' gets V' cup MAX-BW(N(v))$
Else
State $V' gets V' cup {v}$
EndIf
State $V gets V-{v}$
EndFor
end{algorithmic}
end{algorithm}
end{document}
以上來源自論壇
LaTeX Application Notes: Pseudocode (with examples) | | Spark & Shinesparkandshine.net