Vim error E745 'Using a List as a Number' when creating `Latex` snippet in `neosnippet`

362 Views Asked by At

I am using neosnippet to create a snippet for a latex template. The snippet is rather long, and I keep getting a strange error E745 Using a List as a Number when I try to expand the snippet.

Here is the error message that neovim is putting out.

[dein] Error occurred while executing hook: neosnippet.vim
[dein] Vim(let):E745: Using a List as a Number
Error detected while processing function <SNR>346 snippets_expand ...
Line 11
E15: invalid expression:
E15: invalid expression

The actual snippet itself is below--it is quite long. Now when I take this long snippet out of the snippet file, all other snippets work fine. So it seems somewhere I am using a character I am not supposed to use or something. Or perhaps something is not properly escaped, etc.

All of my other latex snippets work just fine, but there are also much shorter. Does anyone have any ideas about why this snippet is causing so much trouble?

Here is the latex snippet.

\documentclass{book}
\addtolength{\topmargin}{-.5in}
\addtolength{\headsep}{.5in}
\oddsidemargin=.5in
\evensidemargin=.5in
\textwidth=5.5in
\usepackage{
amsmath,% AMS basic math stuff
amsthm,% AMS theorem defining stuff
amsfonts,% defines the blackboard bold fonts for \Z, \R, etc
longtable,% used to create the tcproof environment below
verbatim,% allows for verbatim output, and also covering up stuff in comments
xspace,% adds an extra space an the end of some commands
multicol,% allows multicolumn output
tikz,% creates the tikzpicture drawing environment
charter,% changes the default font to charter
framed,% used to color in the TIscreen environment below
bm,
mathrsfs}
\usepackage{pifont}
\usepackage[colorlinks,unicode]{hyperref}

\newcommand{\R}{\mathbb{R}}
\newcommand{\Q}{\mathbb{Q}}
\newcommand{\Z}{\mathbb{Z}}
\newcommand{\N}{\mathbb{N}}
\newcommand{\Tau}{\bm{\mathcal{T}}}
\newcommand{\Taup}{\bm{\mathcal{T}^{\prime}}}
\newcommand{\Bp}{\mathscr{B}^{\prime}}
\newcommand{\B}{\mathscr{B}}
\newcommand{\CCp}{\mathscr{C}^{\prime}}
\newcommand{\CC}{\mathscr{C}}
\newcommand{\Ltop}{\R_{\mathscr{L}}}
\newcommand{\Ktop}{\R_{\mathscr{K}}}

\DeclareMathOperator{\lcm}{lcm}

\newcommand{\cl}[1]{[#1]}

\newcommand{\st}{\mid}

\newcommand{\eq}{\stackrel{?}{=}}

\newcommand{\divq}{\stackrel{?}{|}}

\newcommand{\forwards}{\mbox{``$\Longrightarrow$''}\xspace}
\newcommand{\backwards}{\mbox{``$\Longleftarrow$''}\xspace}


\newcommand{\define}[1]{\textbf{#1}}

\newcommand{\threeven}{pretty\xspace}
\newcommand{\throd}{normal\xspace}
\newcommand{\throve}{ugly\xspace}


\DeclareMathSymbol{\nmid}{\mathrel}{AMSb}{"2D}
\newcommand{\notdiv}{\nmid}


\renewcommand{\tilde}{\widetilde}


\renewcommand{\thefootnote}{\fnsymbol{footnote}}

\def\endclass#1{\par\noindent\hrulefill\fbox{\tiny This is where we
    ended on #1}\hrulefill\vskip 5pt plus 1pt\par }


\pagestyle{headings}
\makeatletter

\edef\today{%
  \the\year/\two@digits{\the\month}/\two@digits{\the\day}}

\renewcommand{\@evenhead}{\emph{Ordinary Differential Equations - Arnold}
   (v. \today)
    \hfill Krishna Bhogaonker \hfill \thepage}
\renewcommand{\@oddhead}{(version \today) \hfill \thepage}
\makeatother

\DeclareMathSymbol{\varnothing}{\mathord}{AMSb}{"3F}
\renewcommand{\emptyset}{\varnothing}

\colorlet{shadecolor}{gray!35}
\newenvironment{TIscreen}
{\begin{center}\tt
\renewcommand{\in}[1]{##1\\}
\newcommand{\out}[1]{\mbox{}\hfill##1\\}
\begin{minipage}{2in}\begin{snugshade}}
{\end{snugshade}\end{minipage}\end{center}}



\newenvironment{tcproof}[1]
{\smallskip\par\begin{longtable}{@{}p{.45\textwidth}p{.45\textwidth}@{}}
\multicolumn{2}{@{}l}{\emph{#1}}\\[\smallskipamount]
Assertion & Justification \endfirsthead
Assertion & Justification \endhead
\hline }
{\end{longtable}\qed\smallskip\par}

\newtheorem{lemma}{Lemma}[section]
\newtheorem{theorem}[lemma]{Theorem}
\newtheorem{cor}[lemma]{Corollary}
\newtheorem*{scholium}{Scholium}


\theoremstyle{definition}
\newtheorem{definition}[lemma]{Definition}
\newtheorem{example}[lemma]{Example}
\newenvironment{comments}{}{}

\makeatletter

  \define@key{hide}{scholium}[true]{\renewenvironment{scholium}{\comment}{\endcomment}}
  \define@key{hide}{proof}[true]{\renewenvironment{proof}{\comment}{\endcomment}}
  \define@key{hide}{lemma}[true]{\renewenvironment{lemma}{\comment}{\endcomment}}
  \define@key{hide}{comments}[true]{\renewenvironment{comments}{\comment}{\endcomment}}
  \define@key{hide}{cor}[true]{\renewenvironment{cor}{\comment}{\endcomment}}
  \define@key{hide}{definition}[true]{\renewenvironment{definition}{\comment}{\endcomment}}
  \define@key{hide}{example}[true]{\renewenvironment{example}{\comment}{\endcomment}}
  \define@key{hide}{theorem}[true]{\renewenvironment{theorem}{\comment}{\endcomment}}

\newcommand{\HideEnvirons}[1]{\setkeys{hide}{#1}}


  \define@key{show}{scholium}[true]{\define@key{hide}{scholium}{}}
  \define@key{show}{proof}[true]{\define@key{hide}{proof}{}}
  \define@key{show}{lemma}[true]{\define@key{hide}{lemma}{}}
  \define@key{show}{comments}[true]{\define@key{hide}{comments}{}}
  \define@key{show}{cor}[true]{\define@key{hide}{cor}{}}
  \define@key{show}{definition}[true]{\define@key{hide}{definition}{}}
  \define@key{show}{example}[true]{\define@key{hide}{example}{}}
  \define@key{show}{theorem}[true]{\define@key{hide}{theorem}{}}

\newcommand{\ShowEnvirons}[1]
{\setkeys{show}{#1}\HideEnvirons{%
    comments,
    cor,
    definition,
    example,
    proof,
    theorem,
    lemma,
    scholium
  }}
\makeatother



\begin{document}
\tableofcontents
\newpage


\chapter{Basic Concepts}

${0}




\end{document}
1

There are 1 best solutions below

0
On

Okay, I talked to the developer and he indicated the problem had to do with the backquotes in this section of the document.

\newcommand{\forwards}{\mbox{````$\Longrightarrow$''}\xspace}
\newcommand{\backwards}{\mbox{````$\Longleftarrow$''}\xspace}

I updated the neosnippet plugin and also changed the latex code as well. Now things work fine.