無論內容如何,特定列表中的 \iffalse 不完整

無論內容如何,特定列表中的 \iffalse 不完整

我有一個 LaTeX 程式碼,它在特定行給出了這些錯誤:

  • Incomplete \iffalse; all text was ignored after line 140.
  • Forbidden control sequence found while scanning text of \write.在第 140 行

然後在文件的末尾:

  • Argument of \@gobble has an extra }. \end{document}
  • Missing } inserted. \end{document}
  • ETC。

以下程式碼引發錯誤(第 140 行位於y[ row[i] ] += ...\section{COO Kernel}):

\documentclass[11pt,oneside,czech,american]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[a4paper]{geometry}
\geometry{verbose,tmargin=4cm,bmargin=3cm,lmargin=3cm,rmargin=2cm,headheight=0.8cm,headsep=1cm,footskip=0.5cm}
\pagestyle{headings}
\setcounter{secnumdepth}{3}
\usepackage{url}
\usepackage{listings}
\usepackage{textcomp}
\usepackage{amsmath}
\usepackage{xcolor}

\makeatletter

\newenvironment{lyxlist}[1]
{\begin{list}{}
{\settowidth{\labelwidth}{#1}
 \setlength{\leftmargin}{\labelwidth}
 \addtolength{\leftmargin}{\labelsep}
 \renewcommand{\makelabel}[1]{##1\hfil}}}
{\end{list}}
\usepackage[varg]{txfonts}
\usepackage{indentfirst}

\clubpenalty=9500

\widowpenalty=9500

\hyphenation{CDFA HARDI HiPPIES IKEM InterTrack MEGIDDO MIMD MPFA DICOM ASCLEPIOS MedInria}

\definecolor{light-gray}{gray}{0.95}
\newcommand{\code}[1]{\colorbox{light-gray}{\texttt{#1}}}

\definecolor{listinggray}{gray}{0.9}
\definecolor{lbcolor}{rgb}{0.9,0.9,0.9}
\definecolor{Darkgreen}{rgb}{0.0, 0.2, 0.13}
\lstset{
    backgroundcolor=\color{lbcolor},
    tabsize=4,    
    language=[GNU]C++,
    basicstyle=\scriptsize,
    upquote=true,
    aboveskip={0.001\baselineskip},
    columns=fixed,
    showstringspaces=false,
    extendedchars=false,
    breaklines=true,
    prebreak = \raisebox{0ex}[0ex][0ex]{\ensuremath{\hookleftarrow}},
    frame=single,
    numbers=left,
    showtabs=false,
    showspaces=false,
    showstringspaces=false,
    identifierstyle=\ttfamily,
    keywordstyle=\color[rgb]{0,0,1},
    commentstyle=\color[rgb]{0.026,0.112,0.095},
    stringstyle=\color[rgb]{0.627,0.126,0.941},
    numberstyle=\color[rgb]{0.205, 0.142, 0.73},
}
\lstset{
    backgroundcolor=\color{lbcolor},
    tabsize=4,
    language=C++,
    captionpos=b,
    tabsize=3,
    frame=lines,
    numbers=left,
    numberstyle=\tiny,
    numbersep=5pt,
    breaklines=true,
    showstringspaces=false,
    basicstyle=\footnotesize,
    keywordstyle=\color[rgb]{0,0,1},
    commentstyle=\color{Darkgreen},
    stringstyle=\color{red},
}
\lstset{
    morekeywords={__global__},
    alsoletter={.},
    morekeywords={blockDim.x},
    morekeywords={blockIdx.x},
    morekeywords={threadIdx.x}
}

\usepackage{babel}
\begin{document}
\tableofcontents{}

\chapter*{Implementation/Kernels of formats}

\addcontentsline{toc}{chapter}{Implementation/Kernels of formats}

\setcounter{chapter}{3}
\setcounter{section}{0}

\section{DIAG Kernel}

\begin{lstlisting}[caption= SpMV pseudocode using DIAG format for storing a matrix from \textit{Efficient sparse matrix-vector multiplication on CUDA} \cite{Bell-Garland}.]
__global__ void
spmv_dia_kernel ( const int num_rows,
                        const int num_cols,
                        const int num_diags,
                        const int   * offsets,
                        const float * data,
                        const float * x,
                                float * y )
{
    int row = blockDim.x * blockIdx.x + threadIdx.x;
    if ( row < num_rows ){
          float dot = 0;

          for ( int n = 0; n < num_diags; n++ ){
                  int col = row + offsets[ n ];
                  float val = data[ num_rows * n + row ];

                  if ( col >= 0 && col < num_cols )
                        dot += val * x[ col ];
          }

          y[ row ] += dot;
    }
}
\end{lstlisting}
\label{Code:Diagonal-matrix-example}

\section{COO Kernel}

\begin{lstlisting}[caption= SpMV pseudocode using COO format for storing a matrix \cite{Parallel-Uppsala}.]
__global__ void
spmv_coo_kernel ( const int num_non_zero_elements,
                       const float * data,
                       const int   * row,
                       const int   * col,
                       const float * x,
                               float * y )
{
    int i = blockDim.x * blockIdx.x + threadIdx.x;
    if ( row < num_non_zero_elements )
          y[ row[i] ] += data[i] * x[ col[i] ];
}
\end{lstlisting}

\section{ELL Oriented Kernels}

\subsection{ELL Kernel}

\begin{lstlisting}[caption = SpMV pseudocode using ELL format for storing a matrix from \textit{Efficient sparse matrix-vector multiplication on CUDA} \cite{Bell-Garland}.]
__global__ void
spmv_ell_kernel ( const int num_rows,
                       const int num_cols,
                       const int num_cols_per_row,
                       const int   * indices,
                       const float * data,
                       const float * x,
                            float * y )
{
    int row = blockDim.x * blockIdx.x + threadIdx.x;

    if( row < num_rows ){
         float dot = 0;

         for ( int n = 0; n < num_cols_per_row; n++ ){
                int col = indices[ num_rows * n + row ];
                float val = data[ num_rows * n + row ];

                 if ( val != 0 )
                       dot += val * x[ col ];
         }

         y[ row ] += dot;
    }
}
\end{lstlisting}

\begin{thebibliography}{1}
\bibitem{Bell-Garland}N Bell, M. Garland: \emph{Efficient sparse matrix-vector multiplication on CUDA}. NVIDIA Technical Report NVR-2008-004, NVIDIA Corporation, 1-32, 2008.

\bibitem{Parallel-Uppsala}D. Lukarski: \emph{Sparse Matrix-Vector Multiplication and Matrix Formats}. Parallel Algorithms for Scientific Computing, Uppsala University, 2013. \url{https://www.it.uu.se/education/phd_studies/phd_courses/pasc/lecture-1}
\end{thebibliography}

\end{document}

由於某種原因,對bibitems 的引用是未定義的,即使似乎沒有任何拼字錯誤。

如果我回滾導致錯誤的更改,為了正確編譯文檔,我必須刪除.aux.toc文件。

我幾乎是愚蠢的。

PS:序言是一位教授創建的模板,供所有學生使用,我被告知不要插手。

[編輯]:按照建議創建了最小的相同錯誤輸出範例。

[編輯]:新增日誌檔。

[編輯]:刪除了 GitHub 鏈接、完整項目鏈接和日誌文件鏈接,因為它們對於答案來說不是必需的。我會把它們放在一個單獨的資料夾如果有人想看的話,也不會刪除它。如果由於任何原因連結被破壞,請告訴我,我會以某種方式更新它們,因為我也會保留所述文件的備份。

答案1

這個問題的解決方案是在使用者和管理模式下更新我的 MiKTeX,就像 @UlrikeFischer 所說:

更新你的 tex 系統 - 最重要的是清單包。使用最新版本它又可以工作了。 (在使用者和管理模式下檢查更新)。

為竊取答案而道歉,我只想透過要求寫評論作為答案來關閉這個已解決的問題,而不是進一步發送垃圾郵件。

如果您希望我接受您的回答,請隨時回答,我會接受。

相關內容