How to use latex gracefully on mac

Why this document was written

After a week's exposure to latex, I suddenly want to record the configuration of latex environment on mac for people who need to use it. I won't introduce all kinds of knowledge about latex here. I'll go straight to the subject!
I'm used to using Microsoft's vscode to write things. I think it's small, super smooth, rich in plug-ins, and very convenient.

Enter the theme

Command installation of related software

You can use Homebrew to install the required software. Please refer to other articles for the installation and use of Homebrew.

Install mactex

Select MacTeX as the LaTeX compilation engine:

brew cask install mactex

Install vscode

Select VSCode as the editor for LaTex:

brew cask install visual-studio-code

Install Skim

Select skim as the browser of pdf file

brew cask install skim

Configuration of related environment

Installing the LaTeX Workshop plug-in

Open VS Code, search plug-in: LaTeX Workshop, click Install (the figure below has been installed), and restart VS Code.

Modify User Setting configuration

Code --> Performance --> Setting --> User Setting

You can search with the keyword tools or recipes:

LaTeX Workshop's default compilation tool is latexmk. Modify the required tools and commands as needed. Here, change it to xelatex, the most commonly used tool in Chinese environment, and modify it as required.
Use the following to configure:

{
    "latex-workshop.latex.recipes": [{
    "name": "xelatex",
    "tools": [
        "xelatex"
    ]
  }, {
    "name": "latexmk",
    "tools": [
        "latexmk"
    ]
  },
  
  {
    "name": "pdflatex -> bibtex -> pdflatex*2",
    "tools": [
        "pdflatex",
        "bibtex",
        "pdflatex",
        "pdflatex"
    ]
  }
  ],
  
  "latex-workshop.latex.tools": [{
  "name": "latexmk",
  "command": "latexmk",
  "args": [
    "-synctex=1",
    "-interaction=nonstopmode",
    "-file-line-error",
    "-pdf",
    "%DOC%"
  ]
  }, {
  "name": "xelatex",
  "command": "xelatex",
  "args": [
    "-synctex=1",
    "-interaction=nonstopmode",
    "-file-line-error",
    "%DOC%"
  ]
  }, {
  "name": "pdflatex",
  "command": "pdflatex",
  "args": [
    "-synctex=1",
    "-interaction=nonstopmode",
    "-file-line-error",
    "%DOC%"
  ]
  }, {
  "name": "bibtex",
  "command": "bibtex",
  "args": [
    "%DOCFILE%"
  ]
  }],
  "latex-workshop.view.pdf.viewer": "tab",
  "latex-workshop.latex.clean.fileTypes": [
  "*.aux",
  "*.bbl",
  "*.blg",
  "*.idx",
  "*.ind",
  "*.lof",
  "*.lot",
  "*.out",
  "*.toc",
  "*.acn",
  "*.acr",
  "*.alg",
  "*.glg",
  "*.glo",
  "*.gls",
  "*.ist",
  "*.fls",
  "*.log",
  "*.fdb_latexmk"
  ],
}


Restart VSCode after configuration.

Tags: brew Mac

Posted on Wed, 30 Oct 2019 22:08:44 -0700 by galafura