# Latex On VScode 1.安裝發行版 --- 現在的發行版有兩種: MiTeX(執行到需要的封包,才會下載)、TeXLive(先把全部封包載好) 自己習慣用MiTeX,載點: https://miktex.org/download 安裝一路往下點就好 (2) 打開MiTeX console  (3) 點擊check for update,之後update now  (4)可以在Package下載需要的套件,可先不選,系統會自動安裝  2.安裝Perl --- perl是一種動態語言,同腳本語言,不用經過編譯器,只需要告訴perl執行就好。 在LaTeX中,Perl用於處理一些任務,像是在生成文檔的過程,執行自動化操作或產生特定的輸出。 (1) 下載Strawberry Perl,載點: https://strawberryperl.com/ 直接執行即可 (2) 編輯系統環境變數  (3) 環境變數->系統變數的Path->編輯  (4) 新增->確定  3.設定VScode與Latex Workshop --- (1) 安裝VScode擴充Latex Workshop  (2) 點擊setting搜尋recipe  (3)將xelatexmk移至最上行,並存檔 調整前  調整後  4.測試環境 --- (1) 編寫一段Latex範本  ```latex= \documentclass{article} \begin{document} \title{My First LaTeX Document} \author{Your Name} \date{\today} \maketitle \section{Introduction} This is my first LaTeX document. It's amazing how easy it is to create professional-looking documents with LaTeX. \section{Mathematics} LaTeX is particularly powerful for typesetting mathematical equations. For example, we can write the equation of a circle as: \[ x^2 + y^2 = r^2 \] \section{Conclusion} In conclusion, LaTeX is a fantastic tool for creating documents with mathematical content. \end{document} ``` (2) 以VS Code打開資料夾  (3) 打開後,未compile前 compile方法: 存檔、按F5、按執行  (4) compile產生pdf檔  (5) 結果  5.使用中文 --- (1) 現在大多使用xeCJK宏包,簡單且問題較少 (2) 範例 ```latex= \documentclass[a4paper, 12pt]{article} %set doc type and font size \usepackage{fontspec} %allow setting fonts \usepackage{xeCJK} %call chinese package xeCJK \setCJKmainfont{SimSun} %set chinese font \setmainfont{Times New Roman} %set English font \XeTeXlinebreaklocale "zh" \XeTeXlinebreakskip = 0pt plus 1pt \title{沒有標題} \author{你的名字} \date{\today} \begin{document} \maketitle 大家好! Hello world! \end{document} ``` (3) 結果  Reference --- [使用VSCode上撰寫中文Latex文件](https://kaibaoom.tw/posts/notes/vscode-latex/) [Install LaTeX Workshop and compile PDF in VSCode LaTeX (Windows)](https://www.youtube.com/watch?v=4lyHIQl4VM8) [Latex中文设置](https://medium.com/@xszhong/chinese-latex-1a261a8b557) [[LaTeX] 如何在文章中輸入中文](https://wlzhong.wordpress.com/2016/10/31/latex-%E5%A6%82%E4%BD%95%E5%9C%A8%E6%96%87%E7%AB%A0%E4%B8%AD%E8%BC%B8%E5%85%A5%E4%B8%AD%E6%96%87/)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up