Apr 26, 2025

xelatex, switching from windows to Mac, Chinese font problems

 之前在windows上的微軟正黑體換到mac上後xelatex就編譯不過了。mac上好像只有黑體沒有正黑體。所以說latex可以獨立於作業軟體mac或windows好像不太對。而且我也遇到不少其它問題。我的mac是macOS Mojave version 10.14.6。

FontAwesome problem on Mac with xelatex

 xelatex fontawesome_problem.tex

This is XeTeX, Version 3.14159265-2.6-0.999992 (TeX Live 2020) (preloaded format=xelatex)

 restricted \write18 enabled.

entering extended mode

(./fontawesome_problem.tex

LaTeX2e <2020-02-02> patch level 5

L3 programming layer <2020-03-06>

(/usr/local/texlive/2020/texmf-dist/tex/latex/standalone/standalone.cls

Document Class: standalone 2018/03/26 v1.3a Class to compile TeX sub-files stan

dalone

Apr 24, 2025

Vim notes

Notes. Useful commands.
  1. vim的documentation很爛。看他的documentation並沒有幫助。好像還是要在網路上找解決方法學比較實際。
  2. 游標的位置是在游標方塊的左邊,按i insert插入的話,會在游標方塊的左邊插入。如果有兩個游標方塊(比如說游標在{或}上時),游標的位置是在比較深色的那個。在Mac上是這樣子。
  3. p是貼在游標的右方。P是貼在游標的左方。
  4. A register is a named storage place. You can think of them as multiple clipboards.
  5. select/copy/paste/delete
    1. select
      1. 在我的mac上,我可以在vim裡直接用滑鼠選取文字。
      2. 按shift + 左或右 不能選取文字(重要,跟MS Word不同)
      3. 按v進visual mode,然後按左右選取。
      4. 按ctrl + v,按左右加上下選取。
      5. vi) or vi} or vi" or vi' 選取(), {}, " ", ' ' 內的內容,只要游標在裡面就可以。
      6. viw can select inner word, cursor anyhwere in the word. And if you continue pressing w, visual mode can continue selecting more words.
      7. (常發生)after v select, you can p paste the info in your register to replace the text v selected. Or you can ctrl v to paste the info in your system clipboard. This works on my Mac. 如果要貼上同一個內容好幾次,最好用"ay,指定register,因為當你選取要被替代的文字,並按p貼上後,貼上的內容OK,但unname register就會變成被替代的文字,這時候要再次貼上p原本的內容到別的地方,就會變成被替代的文字。重要。
      8. To paste the content you copy from Vim to other programs, in Vim, add "+ before yank. For example, press "+y$, this yanks the content to the end of line (y$) into system clipboard, paste into other programs with the usual ctrl v. (在Mac上是cmd v).
      9. v - select text, delete d, into register, paste elsewhere p.

    1. (常發生) 有時候按錯鍵會不小心修改到檔案,還蠻令人緊張的,因為你不知道改了什麼,比如說,要按:結果按錯變成輸入P,結果就貼入了上一次在register的內容,常常嚇一跳。還好,可以用u來復原。還蠻常發生的。再舉個例子,比方說本來要按34j,往下跳34行,結果按錯按到p,34p,結果貼上register34次,把整個版面都覆蓋滿,重點是,一開始還會覺得怎麼會這樣,因為你不曉得按錯,你只會覺得怎麼亂跳出來亂七八糟的東西。一開始學的時候,遇到這種狀況還蠻崩潰的。這種錯誤連用了十年的我現在還是會犯。

    1. ciw - change inner word, word includes underscores but not hyphens
    1. ci' - change inner content in ' ', without ' '.只要指標在' '裡面就可以。
    2. ca' - change outer content in ' ', with ' '.
    3. ci} - change content in { }, without }. 只要指標在{ }裡面就可以。
    4. ca} - change content in { }, with }
    5. for the above 5 changes, cursor can be outside and before the word, '', {}, []. Vim will jump into the brackets. Doesn't work when cursor is after the brackets.
    6. daw, cursor anywhere in a word, including the space in front of or after the word. Generally after the word unless punctuation is encountered.
    7. cit, change content in between like <div> and </div>
    8. same principle applies to cat.
    9. yaw, cursor anywhere, including the space before or after the word. Same as above.
    10. yiw, exclude the space