使用 TexWorks。2 个人使用 Mac OSX,一个使用 El Capitan,一个使用 Yosemite。1 个人使用 linux。
以下代码在Linux上运行:
\begin{tabular}{|l|l|l|} \hline
Scalar form & Meaning & Element-by-element for vectors x and y \\ \hline
\mati{2 + 3} & add & \mati{x .+ y} \\ \hline
\end{lstlistings}
这两个 Mac OSX 都无法运行此代码。这是错误还是出了什么问题?Linux 上的版本是:pdfTeX 3.1415926-2.5-1.40.14 (TeX Live 2013/Debian) Mac OSX 上的版本是:pdfTeX 3.14159265-2.6-1.40.16 (TeX Live 2015)
完整名称:
\documentclass[12pt]{book}
\usepackage[titles]{tocloft}
\setcounter{tocdepth}{0}
\setlength{\cftbeforechapskip}{0pt}
\parindent0pt \parskip10pt % make block paragraphs
\raggedright % do not right justify
\usepackage{listings}
\usepackage[top=0.5in, bottom=1in, left=0.5in, right=0.5in]{geometry}
\usepackage[colorlinks,citecolor=DeepPink4,linkcolor=DarkRed, urlcolor=DarkBlue]{hyperref}
\usepackage{cleveref}
\usepackage{longtable}
\title{test}
\author{foo}
\date{\today}
\lstset{
backgroundcolor=\color{lgray},
% basicstyle=\footnotesize \ttfamily \color{black} \bfseries,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
commentstyle=\color{dkgreen},
deletekeywords={...},
escapeinside={\%*}{*)},
frame=single,
keywordstyle=\textbf,
morekeywords={BRIEFDescriptorConfig,string,TiXmlNode,DetectorDescriptorConfigContainer,istringstream,cerr,exit},
identifierstyle=\color{black},
stringstyle=\color{blue},
language=Java,
numbers=right,
numbersep=5pt,
numberstyle=\tiny\color{black},
rulecolor=\color{black},
showspaces=false,
showstringspaces=false,
showtabs=false,
stepnumber=1,
tabsize=5,
title=\lstname,
}
\newcommand{\matlab}{\begin{lstlisting}[language=matlab]}
\newcommand\mati[1]{{\lstinline[language=matlab]{#1}}}
\raggedbottom
\title{\bf Test Title}
\begin{document} % End of preamble, start of text.
\frontmatter % only in book class (roman page #s)
\maketitle % Print title page.
\pagebreak
credits go here
\pagebreak
\tableofcontents % Print table of contents
\newpage
\mainmatter % only in book class (arabic page #s)
\begin{tabular}{|l|l|l|} \hline
Scalar form & Meaning & Element-by-element for vectors x and y \\ \hline
\mati{2 + 3} & add & \mati{x .+ y} \\ \hline
\mati{2 - 3} & subtract & \mati{x .- y} \\ \hline
\mati{2 * 3} & multiply & \mati{x .* y} \\ \hline
\mati{2 / 3} & divide & \mati{x ./ y} \\ \hline
\mati{2 ^ 3} & exponentiation & \mati{x .^ y} \\ \hline
\end{tabular}
\end{document}