latex textbf没有用_LaTeX排版软件札记 Win10 LyX+TeXLive
我使用的是LyX+TeXLive。
LyX界面直觀,類似于Word。可以把精力更多集中在內(nèi)容,而不是在代碼上。
TeXLive庫齊全。
安裝
texlive2019-20190410.iso (~3.3G)
雙擊打開iso,加載到虛擬光驅(qū)。運行install-tl-advanced.bat,按提示安裝。
2. 安裝LyX
https://www.lyx.org/Download?www.lyx.org安裝Installer,即LyX-2352-Installer-4.exe (~58 MB)
latex.exe選擇TexLive latex.exe所在文件夾
3. 配置中文環(huán)境
運行LyX,文檔→首選項
- 文檔類:Chinese Article (CTex)
- 語言:中文(繁體),文件編碼:Unicode(XeTeX)(utf8)
- Formats 輸出格式 PDF(XeTeX)
LyX自帶拼寫檢查:工具→首選項→語言設(shè)置,拼寫檢查器,勾選spellcheck continuously。切換拼寫檢查默認語言:文檔→首選項→語言 。拼寫檢查擴充詞庫
https://wiki.lyx.org/Windows/SpellChecker?wiki.lyx.org4. Enjoy
Note
1. TeXLive必要宏包
documentclass{article}
usepackage{ctex}
usepackage[namelimits]{amsmath}
usepackage{amssymb}
usepackage{amsfonts}
usepackage{mathrsfs}
usepackage{algpseudocode,algorithm,algorithmicx}
2. 論文模板
TeXLive自帶大量宏包,比如prl的RevTeX,直接調(diào)用即可,但仍推薦去官網(wǎng)下載完整版,可參考其模板改寫。編譯格式為pdfLaTeX,需要將LyX文件導出為tex(pdfLaTeX)格式
https://journals.aps.org/revtex?journals.aps.org3. 數(shù)學符號
數(shù)學公式用$ $括住
常用數(shù)學符號:
- <= leq 或 le
- >= geq 或 ge
- << ll
- >> gg
- ≠ neq 或者 ne
- ∈ in
- 不屬于 notin
- × times
- ± pm
4. 算法模板
使用algorithmicx宏包生成偽代碼算法圖
完整教程:
http://tug.ctan.org/macros/latex/contrib/algorithmicx/algorithmicx.pdf?tug.ctan.org4.1 第一例
在TeXworks中使用pdfLaTeX或XeLaTeX執(zhí)行編譯,編譯效果:
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-algorithms?tex.stackexchange.com注1:可利用以下代碼實現(xiàn)Input/Output
algrenewcommandalgorithmicrequire{textbf{Input:}}
algrenewcommandalgorithmicensure{textbf{Output:}}
注2:可使用State、Statex實現(xiàn)代碼帶編號/不帶編號換行。
4.2 第二例
在TeXworks中使用pdfLaTeX或XeLaTeX執(zhí)行編譯,編譯效果:
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 & Shine?sparkandshine.net總結(jié)
以上是生活随笔為你收集整理的latex textbf没有用_LaTeX排版软件札记 Win10 LyX+TeXLive的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 海盗船发布 MP700 PRO PCIe
- 下一篇: 京东 App 上线京言 AI 助手测试版