我一直很难将我的 C++ 代码合并到使用 AMS 书籍模板格式化的文档中。
%-----------------------------------------------------------------------
% Beginning of chapter.tex
%-----------------------------------------------------------------------
%
% This is a sample file for use with AMS-LaTeX. It provides an example
% of how to set up a file for a book to be typeset with AMS-LaTeX.
%
% This is the driver file. Separate chapters should be included at
% the end of this file.
%
% ***** DO NOT USE THIS FILE AS A STARTER FOR YOUR BOOK. *****
% Follow the guidelines in the file chapter.template.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{amsbook}
\usepackage[utf8]{inputenc}
\usepackage{listings}
\usepackage{xcolor}
\lstset{
frame=tb, % draw a frame at the top and bottom of the code block
tabsize=4, % tab space width
showstringspaces=false, % don't mark spaces in strings
numbers=left, % display line numbers on the left
commentstyle=\color{green}, % comment color
keywordstyle=\color{blue}, % keyword color
stringstyle=\color{red} % string color
}
%\includeonly{preface, chap1, array, biblio,index}
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{lemma}[theorem]{Lemma}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{xca}[theorem]{Exercise}
\theoremstyle{remark}
\newtheorem{remark}[theorem]{Remark}
\numberwithin{section}{chapter}
\numberwithin{equation}{chapter}
% Absolute value notation
\newcommand{\abs}[1]{\lvert#1\rvert}
\newcommand{\bcode}{\begin{lstlisting}[language=C++,breaklines]}
\newcommand{\ecode}{\end{lstlisting}}
% Blank box placeholder for figures (to avoid requiring any
% particular graphics capabilities for printing this document).
\newcommand{\blankbox}[2]{%
\parbox{\columnwidth}{\centering
% Set fboxsep to 0 so that the actual size of the box will match the
% given measurements more closely.
\setlength{\fboxsep}{0pt}%
\fbox{\raisebox{0pt}[#2]{\hspace{#1}}}%
}%
}
\begin{document}
\frontmatter
\title{My LaTeX Experiment}
% Address of record for the research reported here
%\address{Department of Mathematics, Louisiana State University, Baton Rouge, Louisiana 70803}
% Current address
%\curraddr{Department of Mathematics and Statistics, Case Western Reserve University, Cleveland, Ohio 43403}
%\email{[email protected]}
% \thanks will become a 1st page footnote.
%\thanks{The first author was supported in part by NSF Grant \#000000.}
% Information for second author
%\author{Author Two}
%\address{Mathematical Research Section, School of Mathematical Sciences,
%Australian National University, Canberra ACT 2601, Australia}
%\email{[email protected]}
\date{July 2, 1991}
\subjclass[2010]{Primary 54C40, 14E20;\\Secondary 46E25, 20C20}
\keywords{\texttt{amsbook}, AMS-\LaTeX}
\begin{abstract}
This document is a sample prepared to illustrate the use of the
American Mathematical Society's \LaTeX{} document class
\texttt{amsbook} and publication-specific variants of that class.
\end{abstract}
\maketitle
\setcounter{page}{4}
\tableofcontents
\include{preface}
\mainmatter
\include{chap1}
\include{array}
\backmatter
\include{biblio}
\include{index}
\end{document}
它给出了错误。有人可以与我分享一些可用的代码吗?
非常感谢您的宝贵时间。