我使用問題集類來鍵入我的問題集。我經常有一個main.tex文件,看起來像下面這樣。vim:在部分LaTeX文件中拼寫檢查
\documentclass{problemset}
\begin{document}
\input{problem1}
\end{document}
我通常對每個問題都有不同的文件。例如,problem1.tex可能如下所示。
\begin{problem}
there is a spelling errrrrrrror here
\end{problem}
我想vim來檢測problem1.tex中的拼寫錯誤,但不幸的是它沒有。正如this post指出,這個問題似乎是,VIM不能識別任何語法區域:當我運行命令
:echo synIDattr(synID(line("."),col("."),1),"name")
我沒有得到任何輸出。再例如,如果我將problem1.tex更改爲以下內容,則拼寫錯誤將被識別。
\section{dummy section}
\begin{problem}
there is a spelling errrrrror here
\end{problem}
我試圖爲我的問題環境創建一個語法區域,但不成功。我的嘗試包括創建以下.vim/syntax/tex.vim文件。
syntax region texProblem start="\\begin{problem}" end="\\end{problem}" [email protected]
當我創建這個tex.vim文件時似乎沒有任何事情發生。我使用腳本名來檢查是否正在加載語法文件(默認語法文件也在我的後面加載)。我還可以通過將文件類型設置爲plaintex來標記拼寫錯誤,如建議here,但這似乎是一個可怕的黑客。似乎應該有一個更好的方法來在我的problem1.tex文件中進行拼寫檢查。
正是我的問題。任何解決方案 – Floyd 2015-02-03 14:28:21
在'vim/syntax/tex.vim'中加入'syntax spell toplevel'工作在我的案例中 – Stirling 2015-02-21 18:27:20
我在debian wheezy/7.8下運行vim73的vim-latexsuite,它也適用於我: cp/usr/share/vim/vim73/syntax/tex.vim。 add''syntax spell toplevel''並且拼寫錯誤現在顯示在\ include-ed文件中。謝謝,斯特林! – Floyd 2015-02-23 06:33:19