diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-09-04 11:33:26 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-09-04 11:33:26 +0200 |
commit | 947be81e7434f37a22970a9bc18aeaa7aab05c9a (patch) | |
tree | 640a3906009c2b0a310ad412098c5999dccedd28 | |
parent | aa58464097897f0fdd1da9d0f6c0321cea2f4e54 (diff) |
rename custom verbatim command/env to work with LaTeX workshop syntax highlighting
-rw-r--r-- | .vimrc | 8 | ||||
-rw-r--r-- | example.tex | 12 | ||||
-rw-r--r-- | projdoc.cls | 4 |
3 files changed, 12 insertions, 12 deletions
@@ -1,12 +1,12 @@ -" fix vimtex highlighting for \code{} -syntax match texCmdVerb "\\code\>\*\?" nextgroup=texVerbZoneInline +" fix vimtex highlighting for custom verbatim commands +syntax match texCmdVerb "\\codeinline\>\*\?" nextgroup=texVerbZoneInline call vimtex#syntax#core#new_arg('texVerbZoneInline', { \ 'contains': '', \ 'matcher': 'start="{" end="}"' \}) -" and \begin{codeblock} ... \end{codeblock} +" and \begin{blockcode} ... \end{blockcode} call vimtex#syntax#core#new_env({ - \ 'name': 'codeblock', + \ 'name': 'blockcode', \ 'region': 'texVerbZone', \}) diff --git a/example.tex b/example.tex index 362ce29..8525973 100644 --- a/example.tex +++ b/example.tex @@ -93,20 +93,20 @@ is neatly handled by cleveref: \subsection{Fonts} -The \code{\emph} command can be used to \emph{emphasize} (i.e.~italicize) text. +The \codeinline{\emph} command can be used to \emph{emphasize} (i.e.~italicize) text. % Note the ~ (non-breaking space) after "i.e.". LaTeX inserts some extra negative % space after a full stop, but since the full stop is used to denote an abbreviation % we need to tell LaTeX to insert a regular space. This can also be achieved by using % "\ ", though this allows LaTeX to break a line after the "i.e." which looks ugly in % my opinion. -The \code{\code} command can be used to insert inline code. +The \codeinline{\codeinline} command can be used to insert inline code. -The \code{codeblock} environment can be used to insert a code block: +The \codeinline{blockcode} environment can be used to insert a code block: -\begin{codeblock} +\begin{blockcode} This is all included verbatim: \verb|asdf| \ $%!(*@#&)$ -\end{codeblock} +\end{blockcode} \subsection{Lists} @@ -138,7 +138,7 @@ Numbered list: \subsection{Citations} -Citations are inserted using the \code{\autocite} command \autocite{rfc:3339}. +Citations are inserted using the \codeinline{\autocite} command \autocite{rfc:3339}. \end{document} diff --git a/projdoc.cls b/projdoc.cls index 02e9542..1a1de81 100644 --- a/projdoc.cls +++ b/projdoc.cls @@ -223,7 +223,7 @@ } % code -\DeclareUrlCommand\code{% +\DeclareUrlCommand\codeinline{% \urlstyle{tt}% \def\codebreak{\discretionary{\hbox{~\textbackslash{}}}{\hbox{~~}}{}}% \def\UrlSpecials{% @@ -241,7 +241,7 @@ \def\UrlLeft{\hbox{\,}}% \def\UrlRight{\hbox{\,}}% } -\DefineVerbatimEnvironment{codeblock}{Verbatim}{ +\DefineVerbatimEnvironment{blockcode}{Verbatim}{ tabsize=2, obeytabs, } |