Add new packages installed

This commit is contained in:
Mateus Pinto Rodrigues
2018-03-27 20:52:59 -03:00
parent e684741609
commit 2362e805bd
1493 changed files with 172412 additions and 4636 deletions

View File

@@ -0,0 +1,24 @@
\setuphead
[section]
[before={\blank[big]},
after={\blank[medium]}]
\setuphead
[subsection]
[
before={\blank[big]},
after={\blank[medium]},
]
\starttext
\startitemize[a]
\item Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
\item Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
\item Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
dolore eu fugiat nulla pariatur.
\stopitemize
\stoptext

View File

@@ -0,0 +1,24 @@
\setuphead
[section]
[before={\blank[big]},
after={\blank[medium]}]
\setuphead
[subsection]
[
before={\blank[big]},
after={\blank[medium]},
]
\starttext
\startitemize[a]
\item Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
\item Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut
aliquip ex ea commodo consequat.
\item Duis aute irure dolor in reprehenderit in voluptate velit esse cillum
dolore eu fugiat nulla pariatur.
\stopitemize
\stoptext

View File

@@ -0,0 +1,44 @@
;;; context-test.el --- tests for ConTeXt mode
;; Copyright (C) 2017 Free Software Foundation, Inc.
;; This file is part of AUCTeX.
;; AUCTeX is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; AUCTeX is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with AUCTeX; see the file COPYING. If not, write to the Free
;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
;; 02110-1301, USA.
;;; Code:
(require 'ert)
(require 'context)
(AUCTeX-set-ert-path
'ConTeXt-indent-test/in
"context-indentation-in.tex"
'ConTeXt-indent-test/out
"context-indentation-out.tex")
(ert-deftest ConTeXt-indent ()
(should (string=
(with-temp-buffer
(insert-file-contents ConTeXt-indent-test/in)
(ConTeXt-mode)
(indent-region (point-min) (point-max))
(buffer-string))
(with-temp-buffer
(insert-file-contents ConTeXt-indent-test/out)
(buffer-string)))))
;;; context-test.el ends here

View File

@@ -0,0 +1,64 @@
;;; error-parsing.el --- tests for error parsing
;; Copyright (C) 2017 Free Software Foundation, Inc.
;; This file is part of AUCTeX.
;; AUCTeX is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; AUCTeX is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with AUCTeX; see the file COPYING. If not, write to the Free
;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
;; 02110-1301, USA.
;;; Code:
(require 'ert)
(require 'tex-buf)
(setq japanese-TeX-error-messages t)
(require 'tex-jp)
(ert-deftest japanese-TeX-help-message ()
"Test the fallback behavior of `TeX-help-error'.
It should pick up error messages from the log file even if
tex-jp.el modified `TeX-error-description-list'."
(should (let* ((dummyfile (make-temp-file "japanese-TeX-ert"))
(logfile (concat dummyfile ".log")))
(find-file logfile)
(insert "\
./errorsamp.tex:3: EROOR NEVER COVERED BY TeX-error-description-list.
l.3 }
FOO BAR
HOGE FUGA
")
(save-buffer 0)
(find-file dummyfile)
;; Actually, the contents of dummyfile is irrelavent to
;; this test. It is only used to make the log file name
;; which is analysed in `TeX-help-error' to be
;; predictable.
(let ((TeX-command-buffer (current-buffer)))
(TeX-help-error
"EROOR NEVER COVERED BY TeX-error-description-list."
"" (current-buffer) 'error))
(delete-other-windows)
(kill-buffer (get-file-buffer logfile))
(delete-file logfile)
(kill-buffer (get-file-buffer dummyfile))
(delete-file dummyfile)
(set-buffer "*TeX Help*")
(goto-char (point-min))
(prog1
(search-forward "From the .log file...")
(kill-buffer)))))
;;; error-parsing.el ends here

View File

@@ -0,0 +1,2 @@
\documentclass{jarticle}
\usepackage{amsmath}

View File

@@ -0,0 +1,52 @@
;;; parse-timing.el --- tests for parse timing
;; Copyright (C) 2017 Free Software Foundation, Inc.
;; This file is part of AUCTeX.
;; AUCTeX is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; AUCTeX is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with AUCTeX; see the file COPYING. If not, write to the Free
;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
;; 02110-1301, USA.
;;; Commentary:
;; In AUCTeX, style hooks must not be executed too early. In
;; particular, they should not be called within the major mode hook
;; because the required settings are sometimes not ready at that
;; timing. A difficult point is that many AUCTeX functions implicitly
;; call `TeX-update-style', which eventually calls style hooks. Thus
;; a complicated hook sometimes triggers style hooks unintentionally.
;; Such cases suits for detection via regression tests.
;;; Code:
(require 'ert)
(require 'tex-jp)
(AUCTeX-set-ert-path
'parse-timing
"parse-timing-test.tex")
(ert-deftest japanese-TeX-style-hook-timing ()
"Test style hooks are not called too early."
(let ((TeX-parse-self t)
(TeX-master t)
(LaTeX-mode-hook '(japanese-latex-mode-initialization
turn-on-reftex)))
(find-file parse-timing)
(should (memq 'AMSTeX
(get reftex-docstruct-symbol
'reftex-label-alist-style)))
(kill-buffer)))
;;; parse-timing.el ends here

View File

@@ -0,0 +1,42 @@
% Please check that all preview images in this buffer come out at the
% correct position. I.e., preview images should hide each \section
% command.
% When done, type C-M-c or M-x exit-recursive-edit.
%
% If the image is at the beginning of the line and "\section{xxx}" is
% placed far rightward of the image, then the result should be considered
% as fail.
% In addition, if the image covers "\section{xxx}" only partially, the
% result should be considered as fail, too.
% On the contrary, if the text shown in the image is garbled while the
% position of the image is correct, then the result should be considered as
% OK. That means that your ghostscript is not configured to handle
% Japanese postscript font names correctly and the functionality of
% preview-latex is just fine.
\documentclass{jarticle}
\begin{document}
\section{<EFBFBD>\(1)}
\section{<EFBFBD>\{a}}
\section{\(<EFBFBD>\\|\)}
\section{<EFBFBD>A<EFBFBD>[<5B>X}
\section{<EFBFBD>^}
% The comment "%<25>\" will be displayed rightward to the image on the next
% line. That is a normal outcome and should be considered as OK.
\section{<EFBFBD><EFBFBD>} %<25>\
\end{document}
%%% Local Variables:
%%% coding: shift_jis
%%% mode: japanese-latex
%%% TeX-master: t
%%% TeX-engine: ptex
%%% TeX-PDF-mode: nil
%%% End:

View File

@@ -0,0 +1,20 @@
% Please check that the preview image in this buffer comes out at the
% correct position. I.e., preview images should hide the equation.
% When done, type C-M-c or M-x exit-recursive-edit.
%
% If the image is at the beginning of the line and does not cover the
% equation, then the result should be considered as fail.
\documentclass{jarticle}
\begin{document}
preview-latex <20><> \(a^{2}=b^{2}+c^{2}\) <20>Τ<CEA4>ʿ<EFBFBD><CABF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܸ<EFBFBD> LaTeX <20>Ǥ<EFBFBD>
preview <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
\end{document}
%%% Local Variables:
%%% coding: euc-jp
%%% mode: japanese-latex
%%% TeX-master: t
%%% TeX-engine: ptex
%%% TeX-PDF-mode: nil
%%% End:

View File

@@ -0,0 +1,42 @@
% Please check that all preview images in this buffer come out at the
% correct position. I.e., preview images should hide each \section
% command.
% When done, type C-M-c or M-x exit-recursive-edit.
%
% If the image is at the beginning of the line and "\section{xxx}" is
% placed far rightward of the image, then the result should be considered
% as fail.
% In addition, if the image covers "\section{xxx}" only partially, the
% result should be considered as fail, too.
% On the contrary, if the text shown in the image is garbled while the
% position of the image is correct, then the result should be considered as
% OK. That means that your ghostscript is not configured to handle
% Japanese postscript font names correctly and the functionality of
% preview-latex is just fine.
\documentclass{jarticle}
\begin{document}
\section{$BI=(B(1)}
\section{$BM=(B{a}}
\section{\($BG=(B\|\)}
\section{$B%"!<%9(B}
\section{$B7?(B}
% The comment "%$BG=(B" will be displayed rightward to the image on the next
% line. That is a normal outcome and should be considered as OK.
\section{$B$"(B} %$BG=(B
\end{document}
%%% Local Variables:
%%% coding: iso-2022-jp
%%% mode: japanese-latex
%%% TeX-master: t
%%% TeX-engine: ptex
%%% TeX-PDF-mode: nil
%%% End:

View File

@@ -0,0 +1,358 @@
\documentclass[a4paper]{article}
\usepackage{expl3}
\usepackage[overload]{empheq}
\usepackage{breqn}
\begin{document}
This is a test document for general fontification support of macros
and environments provided by \LaTeX{} and other packages within
AUC\TeX. As it is not part of \verb|ert|-tests, it does not have an
\verb|out|-counterpart.
\part{Macros}
\section{Special characters}
\subsection{Standard reserved characters}
\subsubsection{\protect\LaTeX{} input}
The following symbols are reserved characters that have a special
meaning under \LaTeX{}.
\begin{center}
\begin{tabular}{@{}*{8}{c}}
\hline
\verb|#| & \verb|$| & \verb|%| & \verb|^|
& \verb|&| & \verb|_| & \verb|{| & \verb|}| \\
\verb|~| & \verb|`| & \verb|'| & \verb|=|
& \verb|.| \\
\hline
\end{tabular}\\
\end{center}
In a document, characters in the first line are printed by using a
prefix \verb|\| (backslash). The characters in the second line become
control symbols taking an argument when prefixed with a backslash.
\subsubsection{AUC\protect\TeX{} fontification}
AUC\TeX{} has the following strategy for fontification:
\begin{description}
\item[Control symbols without argument] do not get any fontification
as they only print a special character and have a textual context,
e.g. \$10, 5\%, Mr.\&Mrs. They are listed below:
\begin{center}
\begin{tabular}{@{}*{4}{cl}@{}}
\hline
\# & \verb|\#| & \$ & \verb|\$|
& \% & \verb|\%| & \& & \verb|\&| \\
\_ & \verb|\_| & \{ & \verb|\{|
& \} & \verb|\}| \\
\hline
\end{tabular}
\end{center}
\item[Control symbols with argument] do not receive any fontification.
These macros take a mandatory argument, but they have a textual
context. Since the argument is usually not enclosed in braces,
fontification would be rather distracting:
\begin{center}
\begin{tabular}{@{}*{4}{cl}@{}}
\hline
\`o & \verb|\`o| & \'o & \verb|\'o|
& \^o & \verb|\^o| & \~o & \verb|\~o| \\
\=o & \verb|\=o| & \.o & \verb|\.o|
& \"o & \verb|\"o| \\
\hline
\end{tabular} \\[1ex]
\begin{minipage}{0.4\linewidth}\centering
H\^{o}tel, na\"\i ve, \'{e}l\`{e}ve,\\
sm\o rrebr\o d, !`Se\~{n}orita!
\end{minipage}\quad
\begin{minipage}{0.4\linewidth}\centering
H\^otel, na\"\i ve, \'el\`eve,\\
sm\o rrebr\o d, !`Se\~norita!
\end{minipage}
\end{center}
\item[Control words] receive fontification, e.g.
\begin{center}
\begin{tabular}{@{}*{4}{cl}@{}}
\hline
\u o & \verb|\u o| & \v o & \verb|\v o|
& \H o & \verb|\H o| & \c o & \verb|\c o| \\
\d o & \verb|\d o| & \b o & \verb|\b o|
& \t oo & \verb|\t oo| \\[6pt]
\oe & \verb|\oe| & \OE & \verb|\OE|
& \ae & \verb|\ae| & \AE & \verb|\AE| \\
\aa & \verb|\aa| & \AA & \verb|\AA|
& \c c & \verb|\c c| \\[6pt]
\o & \verb|\o| & \O & \verb|\O|
& \l & \verb|\l| & \L & \verb|\L| \\
\i & \verb|\i| & \j & \verb|\J|
& \ss & \verb|\ss| \\
\hline
\end{tabular}\\[1ex]
\end{center}
\end{description}
\subsection{@ character}
\subsubsection{\protect\LaTeX{} input}
In regular text, \verb|@| is not a special character and can be used
as `foo@bar'. Further, \verb|\@| can be used to force a wide space
after an uppercase character, e.g. PC\@.
On the other hand, \verb|@| is used as ``letter'' for defining internal
macros, e.g. \verb|\@gobble|.
\subsubsection{AUC\protect\TeX{} fontification}
Being a non-textual macro, \verb|\@| receives a fontification in
AUC\TeX. Used as letter as part of a macro, it gets the fontification
as the rest. Example \bgroup\ttfamily \string\@gobble\egroup.
\subsection{\_ and : characters}
\subsubsection{\protect\LaTeX{} input}
For \LaTeXe, the behavior of \verb|_| and \verb|\_| was described
above. \verb|:| is not special for regular text. \verb|\:| is a
spacing macro ($\frac{4}{18}$ quad) within math mode.
\LaTeX3 does not use \verb|@| as ``letter'' for defining internal
macros. Instead, the symbols \verb|_| and \verb|:| are used in
internal macro names to provide structure. These extra letters are
used only between parts of a macro name (no strange vowel
replacement)\cite{expl3}.
\subsubsection{AUC\protect\TeX{} fontification}
\verb|\:| is only allowed in math mode; fontification is done there,
e.g. $a\:\:+b$ or
\begin{equation}
\int_1^2 \ln x \mathrm{d}x
\qquad
\int_1^2 \ln x \:\:\:\mathrm{d}x
\end{equation}
Regarding \LaTeX3, \verb|expl3| says:
\begin{quote}
3.2.1 Separating private and public material \\
Functions created by a module may either be ``public'' (documented
with a defined interface) or ``private'' (to be used only within
that module, and thus not formally documented). It is important
that only documented interfaces are used; [...] \\
To allow clear separation of these two cases, the following
convention is used. Private functions should be defined with
\verb|__| added to the beginning of the module name. Thus
\begin{quote}
\ttfamily \catcode`\_11\relax
\string\module_foo:nnn
\end{quote}
is a public function which should be documented while
\begin{quote}
\ttfamily \catcode`\_11\relax
\string\__module_foo:nnn
\end{quote}
is private to the module, and should not be used outside of that
module.
\end{quote}
%
Hopefully, this means that \verb|\__module_foo:nnn| macros will not be
used somewhere in the preamble of a \verb|.tex| file -- they should
appear only in a \verb|.dtx| file.
AUC\TeX{} provides a style file \verb|expl3.el| containing this code:
\begin{verbatim}
(defvar LaTeX-expl3-syntax-table
(let ((st (copy-syntax-table LaTeX-mode-syntax-table)))
;; Make _ and : symbol chars
(modify-syntax-entry ?\_ "_" st)
(modify-syntax-entry ?\: "_" st)
st))
\end{verbatim}
It changes the syntax for \verb|_| and \verb|:| from
\textsl{punctuation} to \textsl{symbol}. For public functions
mentioned above, this results in correct fontification in regular
\verb|.tex| files. For private functions, \verb|font-latex.el|
provides some code for doc\TeX{} mode to fontify them correctly.
\section{Math mode}
\subsection{\protect\LaTeX{} input}
In-line math is typeset with plain \TeX{}
\verb|$|\,\textsl{formula\_text}\,\verb|$| or \LaTeX{} shorthand
\verb|\(|\,\textsl{formula\_text}\,\verb|\)|, e.g. $(a+b)^2$ is equal
to \(a^2+2ab+b^2\).
\subsection{AUC\protect\TeX{} fontification}
AUC\TeX{} fontifies math with \texttt{font-latex-math-face}. There is
a bug report \#26630 for this issue: {\bfseries Text before, $(a+b)^2$
is equal to \(a^2+2ab+b^2\)!} First math expression is fontified
with
\begin{quote}
\verb|(font-latex-math-face font-latex-bold-face)|
\end{quote}
while the second with
\begin{quote}
\verb|(font-latex-bold-face font-latex-math-face)|
\end{quote}
\part{Environments}
\section{Math mode}
\subsection{\protect\LaTeX{} input}
Standard \LaTeX{} math environments are \verb|equation|,
\verb|displaymath| and others. \verb|amsmath| package provides
environments like \verb|align|, \verb|flalign| etc. These
environments do not take any arguments. Environments like
\verb|alignat|, \verb|xalignat| and \verb|xxalignat| take a mandatory
argument. Other math environments provided by packages like
\verb|empheq.sty| or \verb|breqn.sty| take an optional and/or
mandatory argument.
\subsection{AUC\protect\TeX{} fontification}
AUC\TeX{} fontifies the entire math content with
\texttt{font-latex-math-face}. The optional and mandatory argument(s)
should not be fontified. Spaces or line breaks are used in order to
distinguish argument from math content, i.e.
\begin{quote}
\verb|\begin{<mathenv>}[<opt-arg>]{<mand-arg>}|
\end{quote}
will be fontified differently than
\begin{quote}
\verb|\begin{<mathenv>}[<opt-arg>] {<math-content>}|
\end{quote}
or
\begin{quote}
\verb|\begin{<mathenv>} [<math-content>]{<math-content>}|
\end{quote}
The relevant functions is \verb|font-latex.el| are
\begin{quote}
\verb|font-latex-match-math-envII|\quad and \\
\verb|font-latex-extend-region-backwards-math-envII|
\end{quote}
\subsubsection{Standard \protect\LaTeX{}}
Examples taken from \cite{voss16}.
\begin{equation}
f(x)=\prod_{i=1}^{n}\left(i-\frac{1}{2i}\right)
\end{equation}
or
\begin{displaymath}
f(x)=\prod_{i=1}^{n}\left(i-\frac{1}{2i}\right)
\end{displaymath}
or
\[ f(x)=\prod_{i=1}^{n}\left(i-\frac{1}{2i}\right) \]
or
\begin{eqnarray*}
y & = & d\\
y & = & cx+d\\
y & = & bx^{2}+cx+d\\
y & = & ax^{3}+bx^{2}+cx+d
\end{eqnarray*}
\subsubsection{\texttt{amsmath} package}
Examples taken from \cite{voss16}.
\begin{align}
y &= d & z &= 1 \\
y &= cx+d & z &= x+1 \\
y_{12} &= bx^{2}+cx+d & z &= x^{2}+x+1\nonumber \\
y(x) &= ax^{3}+bx^{2}+cx+d & z &= x^{3}+x^{2}+x+1
\end{align}
or
\begin{alignat}{2}
y &= d & z &= 1 \\
y &= cx+d & z & =x+1 \\
y_{12} &= bx^{2}+cx+d & z &= x^{2}+x+1\nonumber \\
y(x) &= ax^{3}+bx^{2}+cx+d & z &= x^{3}+x^{2}+x+1
\end{alignat}
\subsubsection{\texttt{breqn} package}
Examples taken from \cite{breqn}:
\begin{dmath}
f(x)=\frac{1}{x} \condition{for $x\neq 0$}
\end{dmath}
or
\begin{dmath}[label={sna74}]
\frac{1}{6} \left(\sigma(k,h,0) +\frac{3(h-1)}{h}\right)
+\frac{1}{6} \left(\sigma(h,k,0) +\frac{3(k-1)}{k}\right)
=\frac{1}{6} \left(\frac{h}{k} +\frac{k}{h} +\frac{1}{hk}\right)
+\frac{1}{2} -\frac{1}{2h} -\frac{1}{2k},
\end{dmath}
or \newcommand\mx[1]{\begin{math}#1\end{math}}%
\begin{dseries}[frame]
\mx{v^{[2]} =(0,5,5,0,9,5,1,0)},
\mx{v^{[3]} =(0,9,11,9,10,12,0,1)}.
\end{dseries}
\begin{dgroup*}
\begin{dmath*}
H_1^3 = x_1 + x_2 + x_3
\end{dmath*},
\begin{dmath*}
H_2^2 = x_1^2 + x_1 x_2 + x_2^2 - q_1 - q_2
\end{dmath*},
\begin{dsuspend}
and
\end{dsuspend}
\begin{dmath*}
H_3^1 = x_1^3 - 2x_1 q_1 - x_2 q_1
\end{dmath*}.
\end{dgroup*}
\subsubsection{\texttt{empheq} package}
Examples taken from \cite{empheq}:
\begin{empheq}{align*}
a&= b \tag{*}\\
E&= mc^2 + \int_a^a x\,dx
\end{empheq}
or
\begin{empheq}{alignat=2}
a &= b &\quad c &= d \\
\text{this} &= \text{that} &\quad \mathit{fish}&\neq fish
\end{empheq}
or
\begin{empheq}[innerbox=\fbox,
left=L\Rightarrow]{align}
a&=b\\
E&=mc^2 + \int_a^a x\, dx
\end{empheq}
or
\begin{empheq}[
left={\parbox[c][\EmphEqdisplayheight+\EmphEqdisplaydepth][t]
{4.5cm}
{You may find this kind of description useful.}\enspace}%
]{align}
a&=\int_0^1 x\,dx +\frac{foo + bar}{baz}\\
E&= mc^2
\end{empheq}
\begin{thebibliography}{9}\raggedright
\bibitem{breqn} Downes, Michael J.; H\o gholm, Morten: The
\texttt{breqn} package. Released 2017/01/27.
\bibitem{empheq} H\o gholm, Morten; Madsen, Lars: The \texttt{empheq}
package. Released 2014/08/04.
\bibitem{expl3} The \LaTeX3 Project: The expl3 package and \LaTeX3
programming. Released 2017/04/01.
\bibitem{voss16} Vo\ss, Herbert: Mathematical Typesetting with
\LaTeX. TUG-Version 0.32, released 2016/11/08.
\end{thebibliography}
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

View File

@@ -0,0 +1,143 @@
\documentclass[a4paper]{article}
\usepackage{minted}
\usepackage{listings}
\usepackage{fancyvrb}
\begin{document}
This is a test document for fontification support of verbatim
\emph{macros} provided by \LaTeX{} and other packages within AUC\TeX.
As it is not part of \verb|ert|-tests, it does not have an
\verb|out|-counterpart. Parsing should be enabled when loading this
file, namely \verb|(setq TeX-parse-self t)| in \verb|.emacs|.
\section{The problem}
The \verb|verb| macro provided by vanilla \LaTeX{} does not receive
any special fontification within AUC\TeX. It is fontified with
\verb|font-latex-sedate-face|. Other \verb|verb| macros provided by
packages like \verb|listings|, \verb|minted| or \verb|fancyvrb| are
fontified with \verb|font-lock-keyword-face| as they are added to
\verb|textual| keyword class within \verb|font-latex.el|.
Next issue is that \verb|verb| macros from modern packages take an
optional argument or even a mandatory argument before the
\verb|verbatim| content. This issue was not addressed in
\verb|font-latex.el|.
\section{The solution}
\subsection{Vanilla \LaTeX}
The issue with fontification of \verb|verb| macro is solved in
\verb|font-latex.el| by adding \verb|("verb" "*")| to
\verb|`font-latex-built-in-keyword-classes'|. This construct
fontifies only the macro itself---the argument is left out for
syntactic fontification.
\subsection{Optional argument}
This issue can be fixed in \verb|font-latex.el| by extending the
regexp for \verb|verb| macros with delimiters/braces in
\verb|`font-latex-set-syntactic-keywords'| with:
\begin{quote}
\verb|"\\(?:\\[[^][]*\\(?:\\[[^][]*\\][^][]*\\)*\\]\\)?"|
\end{quote}
The same line is used for matching optional arguments in verbatim
environments.
\section{The result}
\subsection{Vanilla \LaTeX}
Some text \verb|verb input|, % comment
$a+b$ and \verb*"verb input" % comment
\subsection{listings package}
Some text \lstinline|verb input with delims|, % comment
$a+b$ \lstinline[showspaces,basicstyle=\ttfamily]/verb input with delims/, % comment
%
\lstinline[%
basicstyle=\sffamily]!multiline in opt. arg!, % comment
%
\lstinline[%
basicstyle=\sffamily
]-multiline in opt. arg- % comment
Some text \lstinline{verb input with braces}, % comment
$a+b$ \lstinline[showspaces]{verb input with braces}, % comment
%
\lstinline[%
basicstyle=\sffamily]{multiline in opt. arg}, % comment
%
\lstinline[
basicstyle=\sffamily
]{multiline in opt. arg} % comment
\subsection{minted package}
Some text \mint{text}|verb input| % comment
$a+b$ \mint[showspaces]{text}/verb input/ % comment
Some text \mint[
showspaces
]{text}!verb input! % comment
Some text \mint[showspaces]{%
text%
}+verb input+ % comment
\newmint{text}{showspaces} %
\text|verb input| and \text[showspaces=false]|verb input| % comment
\newmint[mytext]{text}{showspaces} %
\mytext|verb input| and \mytext[%
showspaces=false
]|verb input| % comment
Some text \mintinline{text}|verb input| % comment
$a+b$ \mintinline[showspaces]{text}|verb input| % comment
Some text \mintinline[
showspaces
]{text}|verb input| % comment
Some text \mintinline[showspaces]{%
text%
}|verb input| % comment
\newmintinline{text}{showspaces} %
\textinline|verb input with delims| and \textinline[%
showspaces=false
]|verb input with delims| % comment
\textinline{verb input with braces} and \textinline[%
showspaces=false
]{verb input with braces} % comment
\newmintinline[mytextinline]{text}{showspaces} %
\mytextinline|verb input with delims| and \mytextinline[%
showspaces=false
]|verb input with delims|
\mytextinline{verb input with braces} and \mytextinline[%
showspaces=false
]{verb input with braces}
\subsection{fancyvrb package}
Some text \Verb|verb input| and % comment
\Verb[showspaces]|verb input| and \Verb[
showspaces
]|verb input|
Some text \Verb!verb input! and % comment
\Verb[showspaces]"verb input" and \Verb[
showspaces
]#verb input#
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% TeX-command-extra-options: "-shell-escape"
%%% End:

View File

@@ -0,0 +1,28 @@
Lorem ipsum dolor sit amet, consectetur adipisci elit, sed eiusmod \(0 = 1\) tempor incidunt ut $a^{2} + b^{2} = c^{2}$ labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur.
\begin{tabular}{| l | l | l | l |}
Lorem ipsum dolor sit amet, consectetur adipisci & Lorem ipsum dolor sit amet, consectetur adipisci & Lorem ipsum dolor sit amet, consectetur adipisci & Lorem ipsum dolor sit amet, consectetur adipisci
\end{tabular}
% Test for unambiguousness of macros starting a paragraph. E.g.
% caption vs. captionsetup
Lorem ipsum dolor sit amet, consectetur adipisci,
lorem ipsum dolor
\captionsetup{key=val}
sit amet, consectetur adipisci
Lorem ipsum dolor sit amet, consectetur adipisci,
lorem ipsum dolor
\caption{key=val}
sit amet, consectetur adipisci
% par vs. parencite
Lorem ipsum dolor sit amet, consectetur adipisci,
lorem ipsum dolor
\parencite{key}
sit amet, consectetur adipisci
Lorem ipsum dolor sit amet, consectetur adipisci,
lorem ipsum dolor
\par
sit amet, consectetur adipisci

View File

@@ -0,0 +1,26 @@
Lorem ipsum dolor sit amet, consectetur adipisci elit, sed eiusmod
\(0 = 1\) tempor incidunt ut $a^{2} + b^{2} = c^{2}$ labore et dolore
magna aliqua. Ut enim ad minim veniam, quis nostrum exercitationem
ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi
consequatur.
\begin{tabular}{| l | l | l | l |}
Lorem ipsum dolor sit amet, consectetur adipisci & Lorem ipsum dolor sit amet, consectetur adipisci & Lorem ipsum dolor sit amet, consectetur adipisci & Lorem ipsum dolor sit amet, consectetur adipisci
\end{tabular}
% Test for unambiguousness of macros starting a paragraph. E.g.
% caption vs. captionsetup
Lorem ipsum dolor sit amet, consectetur adipisci, lorem ipsum dolor
\captionsetup{key=val} sit amet, consectetur adipisci
Lorem ipsum dolor sit amet, consectetur adipisci, lorem ipsum dolor
\caption{key=val}
sit amet, consectetur adipisci
% par vs. parencite
Lorem ipsum dolor sit amet, consectetur adipisci, lorem ipsum dolor
\parencite{key} sit amet, consectetur adipisci
Lorem ipsum dolor sit amet, consectetur adipisci, lorem ipsum dolor
\par
sit amet, consectetur adipisci

View File

@@ -0,0 +1,165 @@
;;; latex-test.el --- tests for LaTeX mode
;; Copyright (C) 2014--2017 Free Software Foundation, Inc.
;; This file is part of AUCTeX.
;; AUCTeX is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; AUCTeX is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with AUCTeX; see the file COPYING. If not, write to the Free
;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
;; 02110-1301, USA.
;;; Code:
(require 'ert)
(require 'latex)
(AUCTeX-set-ert-path
'LaTeX-indent-tabular-test/in
"tabular-in.tex"
'LaTeX-indent-tabular-test/out
"tabular-out.tex"
'LaTeX-filling/in
"latex-filling-in.tex"
'LaTeX-filling/out
"latex-filling-out.tex"
'LaTeX-math-indent/in
"math-indent-in.tex"
'LaTeX-math-indent/out
"math-indent-out.tex"
'tabular-count-ampersands/in
"tabular-count-ampersands-in.tex"
'tabular-count-ampersands/out
"tabular-count-ampersands-out.tex")
;; Test for detecting \& in a table cell added; see
;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26010
;; Test for missing & in row added; see
;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26032
(ert-deftest LaTeX-indent-tabular ()
(should (string=
(with-temp-buffer
(insert-file-contents LaTeX-indent-tabular-test/in)
(LaTeX-mode)
(indent-region (point-min) (point-max))
(buffer-string))
(with-temp-buffer
(insert-file-contents LaTeX-indent-tabular-test/out)
(buffer-string)))))
;; Another test for indentation, but for math mode, see
;; https://debbugs.gnu.org/cgi/bugreport.cgi?bug=20227 Let's keep those tests
;; separated so it would be easier to find the culprit of a future failure.
(ert-deftest LaTeX-math-indent ()
(should (string=
(with-temp-buffer
(insert-file-contents LaTeX-math-indent/in)
(LaTeX-mode)
(indent-region (point-min) (point-max))
(buffer-string))
(with-temp-buffer
(insert-file-contents LaTeX-math-indent/out)
(buffer-string)))))
;; Test LaTeX code with math modes is indented as expected. This has mostly to
;; do with the value of `LaTeX-fill-break-at-separators' and how
;; `LaTeX-fill-move-to-break-point' handles it. If the test fails, try to look
;; there. The second part of the test looks for unambiguousness of
;; macros starting a paragraph
;; (http://lists.gnu.org/archive/html/auctex/2017-03/msg00009.html)
(ert-deftest LaTeX-filling ()
(should (string=
(with-temp-buffer
(insert-file-contents LaTeX-filling/in)
(LaTeX-mode)
(let ((fill-column 70))
(fill-paragraph)
(let ((cmds '("captionsetup" "caption"
"parencite" "par")))
(dolist (cmd cmds)
(search-forward (concat "\\" cmd))
(save-excursion
(end-of-line 0)
(fill-paragraph)))))
(buffer-string))
(with-temp-buffer
(insert-file-contents LaTeX-filling/out)
(buffer-string)))))
;; Test for bug#19281 (https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19281):
;; make sure AUCTeX is able to insert and modify an environment containing a
;; TeX-esc and braces in its name.
(ert-deftest LaTeX-change-environment-with-esc ()
(should (string=
(with-temp-buffer
(LaTeX-mode)
(LaTeX-insert-environment (concat TeX-esc "foo{bar}"))
(LaTeX-modify-environment "foobar")
(buffer-string))
(with-temp-buffer
(LaTeX-mode)
(LaTeX-insert-environment "foobar")
(buffer-string)))))
;; Test for inserting &'s with `M-RET' in various tabular environment.
;; Following styles are loaded: tabularx, tabulary, longtable,
;; dcolumn, siunitx
(ert-deftest LaTeX-count-ampersands-inserted-in-tabular ()
(should (string=
(with-temp-buffer
(insert-file-contents tabular-count-ampersands/in)
(setq TeX-parse-self t)
(LaTeX-mode)
(goto-char (point-min))
;; Do not ask for opt. argument in (TeX-insert-macro "\\"):
(let ((TeX-insert-macro-default-style 'mandatory-args-only))
(while (search-forward "LaTeX-insert-item" nil t)
(LaTeX-insert-item)))
(buffer-string))
(with-temp-buffer
(insert-file-contents tabular-count-ampersands/out)
(LaTeX-mode)
(buffer-string)))))
(ert-deftest LaTeX-addbibresource ()
"Check parsing of bibliography files added with addbibresource.
In particular, make sure dots are treated correctly and only the
last extension is stripped."
(should
(equal
(with-temp-buffer
(insert "\\addbibresource{../foo-1.bar_2.qux3.ext}")
(LaTeX-mode)
(let ((TeX-parse-self t))
(TeX-update-style t))
(LaTeX-bibliography-list))
'(("../foo-1.bar_2.qux3")))))
(ert-deftest LaTeX-auto-class-regexp ()
"Check parsing optional argument with comment correctly.
Test against RequirePackage."
(with-temp-buffer
(insert "\\RequirePackage[
backend=biber % here is a comment
]{biblatex}
")
(latex-mode)
(let ((TeX-parse-self t))
(TeX-update-style t))
(should (member "biblatex" (TeX-style-list)))
(should (LaTeX-provided-package-options-member
"biblatex" "backend=biber"))))
;;; latex-test.el ends here

View File

@@ -0,0 +1,17 @@
\[
x
\]
\[
\begin{split}
x &= y \\
y &= z
\end{split}
\]
\begin{itemize}
\item Some text here
\[
x
\]
\end{itemize}

View File

@@ -0,0 +1,17 @@
\[
x
\]
\[
\begin{split}
x &= y \\
y &= z
\end{split}
\]
\begin{itemize}
\item Some text here
\[
x
\]
\end{itemize}

View File

@@ -0,0 +1,84 @@
\documentclass{article}
\usepackage{tabularx,tabulary,longtable,dcolumn,siunitx}
\begin{document}
Standard LaTeX tabular:
\begin{tabular}[t]{llll}
1 & 2 & 3 & LaTeX-insert-item
\end{tabular}
LaTeX tabular with *-operator:
\begin{tabular}[t]{*{3}{l}r}
1 & 2 & 3 & LaTeX-insert-item
\end{tabular}
\begin{tabular}{*{3}{l}>{\tiny\hfill}l<{\hfill}}
1 & 2 & 3 & LaTeX-insert-item
\end{tabular}
\begin{tabular}[t]{*{3}{lc}r}
1 & 2 & 3 & 4 & 5 & 6 & LaTeX-insert-item
\end{tabular}
\begin{tabular}[t]{*{3}{lc*{2}{l}} r}
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & LaTeX-insert-item
\end{tabular}
Standard LaTeX tabular*:
\begin{tabular*}{1.0\linewidth}[t]{@{}lllr@{}}
1 & 2 & 3 & LaTeX-insert-item
\end{tabular*}
\begin{tabular*}{1.0\linewidth}[t]{@{}*{3}{|l}|r|}
1 & 2 & 3 & LaTeX-insert-item
\end{tabular*}
tabularx:
\begin{tabularx}{1.0\linewidth}{llX}
1 & 2 & LaTeX-insert-item
\end{tabularx}
\begin{tabularx}{1.0\linewidth}[t]{@{}>{\tiny\hfill}l<{\hfill}lX@{}}
1 & 2 & LaTeX-insert-item
\end{tabularx}
\begin{tabularx}{1.0\linewidth}[t]{*{3}{|>{\tiny\hfill}X<{\hfill}}l}
1 & 2 & 3 & LaTeX-insert-item
\end{tabularx}
longtable:
\begin{longtable}[l]{llr}
\caption{Some caption}\\
1 & 2 & LaTeX-insert-item
\end{longtable}
\begin{longtable}[c]{*{3}{l}r}
\caption{Some caption}\\
1 & 2 & 3 & LaTeX-insert-item
\end{longtable}
\begin{longtable}[r]{*{3}{lc*{2}{l}} r}
\caption{Some caption}\\
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & LaTeX-insert-item
\end{longtable}
dcolumn:
\begin{tabular}{D{,}{,}{2}D{,}{,}{2}D{,}{,}{2}}
1 & 2 & LaTeX-insert-item
\end{tabular}
\begin{tabular}{*{3}{D{,}{,}{2}}}
1 & 2 & LaTeX-insert-item
\end{tabular}
siunitx:
\begin{tabular}{%
s
S[table-number-alignment = center]
s[table-number-alignment = left]
S[table-number-alignment = right]
}
1 & 2 & 3 & LaTeX-insert-item
\end{tabular}
\end{document}

View File

@@ -0,0 +1,100 @@
\documentclass{article}
\usepackage{tabularx,tabulary,longtable,dcolumn,siunitx}
\begin{document}
Standard LaTeX tabular:
\begin{tabular}[t]{llll}
1 & 2 & 3 & LaTeX-insert-item \\
&&&
\end{tabular}
LaTeX tabular with *-operator:
\begin{tabular}[t]{*{3}{l}r}
1 & 2 & 3 & LaTeX-insert-item \\
&&&
\end{tabular}
\begin{tabular}{*{3}{l}>{\tiny\hfill}l<{\hfill}}
1 & 2 & 3 & LaTeX-insert-item \\
&&&
\end{tabular}
\begin{tabular}[t]{*{3}{lc}r}
1 & 2 & 3 & 4 & 5 & 6 & LaTeX-insert-item \\
&&&&&&
\end{tabular}
\begin{tabular}[t]{*{3}{lc*{2}{l}} r}
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & LaTeX-insert-item \\
&&&&&&&&&&&&
\end{tabular}
Standard LaTeX tabular*:
\begin{tabular*}{1.0\linewidth}[t]{@{}lllr@{}}
1 & 2 & 3 & LaTeX-insert-item \\
&&&
\end{tabular*}
\begin{tabular*}{1.0\linewidth}[t]{@{}*{3}{|l}|r|}
1 & 2 & 3 & LaTeX-insert-item \\
&&&
\end{tabular*}
tabularx:
\begin{tabularx}{1.0\linewidth}{llX}
1 & 2 & LaTeX-insert-item \\
&&
\end{tabularx}
\begin{tabularx}{1.0\linewidth}[t]{@{}>{\tiny\hfill}l<{\hfill}lX@{}}
1 & 2 & LaTeX-insert-item \\
&&
\end{tabularx}
\begin{tabularx}{1.0\linewidth}[t]{*{3}{|>{\tiny\hfill}X<{\hfill}}l}
1 & 2 & 3 & LaTeX-insert-item \\
&&&
\end{tabularx}
longtable:
\begin{longtable}[l]{llr}
\caption{Some caption}\\
1 & 2 & LaTeX-insert-item \\
&&
\end{longtable}
\begin{longtable}[c]{*{3}{l}r}
\caption{Some caption}\\
1 & 2 & 3 & LaTeX-insert-item \\
&&&
\end{longtable}
\begin{longtable}[r]{*{3}{lc*{2}{l}} r}
\caption{Some caption}\\
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & LaTeX-insert-item \\
&&&&&&&&&&&&
\end{longtable}
dcolumn:
\begin{tabular}{D{,}{,}{2}D{,}{,}{2}D{,}{,}{2}}
1 & 2 & LaTeX-insert-item \\
&&
\end{tabular}
\begin{tabular}{*{3}{D{,}{,}{2}}}
1 & 2 & LaTeX-insert-item \\
&&
\end{tabular}
siunitx:
\begin{tabular}{%
s
S[table-number-alignment = center]
s[table-number-alignment = left]
S[table-number-alignment = right]
}
1 & 2 & 3 & LaTeX-insert-item \\
&&&
\end{tabular}
\end{document}

View File

@@ -0,0 +1,82 @@
\documentclass{article}
\begin{document}
\begin{tabular}{llll}
Lorem ipsum dolor & sit amet, ei mei
paulo tation honestatis,
intellegam & accommodare ne vim, ut
mel solum putant
atomorum. Posse & dolores has ut,\\
prompta & disputando & ne mel, ne
viderer ceteros
vel. & No petentium
\\
reformidans mel. & Quo no sale
natum, cu
pericula & deterruisset
usu. Nec & bonorum detracto\\
detraxit & no. & Ne sea doming & deserunt.
\end{tabular}
\begin{tabular}{ll}
1 & 2 & 3
\\
& 4 & 5
\\
6 & 7
& 8\\
9 &
10
& 11
\end{tabular}
\begin{align}
1 & 2
3 & 4
5\\
6 &
7
8 &
9
\end{align}
% Next table tests filling with a control symbol \& inside a cell; the
% function `LaTeX-indent-tabular' now (March 2017) detects \&, see:
% https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26010
\begin{tabular}{llll}
Lorem ipsum dolor & sit amet, ei mei \&
paulo tation honestatis, \&
intellegam & accommodare ne vim, ut
mel solum putant
atomorum. Posse & dolores has ut,\\
prompta & disputando & ne mel, ne
\& viderer ceteros
vel. & No petentium
\end{tabular}
% Next tables test filling when & (column separator) character is
% missing in a row; the function `LaTeX-hanging-ampersand-position'
% now (March 2017) detects this and has a fallback, see:
% https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26032
\begin{tabular}{llll}
\multicolumn{4}{c}{Lorem ipsum dolor sit amet, ei mei} \\
& paulo tation honestatis,
intellegam accommodare ne vim, ut \\
& mel solum putant atomorum. Posse & dolores has ut, \\
prompta & disputando & ne mel, ne
\& viderer ceteros vel. \\
& No petentium
\end{tabular}
\begin{table}[tbp]
\begin{tabular}{llll}
\multicolumn{4}{c}{Lorem ipsum dolor sit amet, ei mei} \\
& paulo tation honestatis,
intellegam accommodare ne vim, ut \\
& mel solum putant atomorum. Posse & dolores has ut, \\
prompta & disputando & ne mel, ne
\& viderer ceteros vel. \\
& No petentium
\end{tabular}
\end{table}
\end{document}

View File

@@ -0,0 +1,82 @@
\documentclass{article}
\begin{document}
\begin{tabular}{llll}
Lorem ipsum dolor & sit amet, ei mei
paulo tation honestatis,
intellegam & accommodare ne vim, ut
mel solum putant
atomorum. Posse & dolores has ut,\\
prompta & disputando & ne mel, ne
viderer ceteros
vel. & No petentium
\\
reformidans mel. & Quo no sale
natum, cu
pericula & deterruisset
usu. Nec & bonorum detracto\\
detraxit & no. & Ne sea doming & deserunt.
\end{tabular}
\begin{tabular}{ll}
1 & 2 & 3
\\
& 4 & 5
\\
6 & 7
& 8\\
9 &
10
& 11
\end{tabular}
\begin{align}
1 & 2
3 & 4
5\\
6 &
7
8 &
9
\end{align}
% Next table tests filling with a control symbol \& inside a cell; the
% function `LaTeX-indent-tabular' now (March 2017) detects \&, see:
% https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26010
\begin{tabular}{llll}
Lorem ipsum dolor & sit amet, ei mei \&
paulo tation honestatis, \&
intellegam & accommodare ne vim, ut
mel solum putant
atomorum. Posse & dolores has ut,\\
prompta & disputando & ne mel, ne
\& viderer ceteros
vel. & No petentium
\end{tabular}
% Next tables test filling when & (column separator) character is
% missing in a row; the function `LaTeX-hanging-ampersand-position'
% now (March 2017) detects this and has a fallback, see:
% https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26032
\begin{tabular}{llll}
\multicolumn{4}{c}{Lorem ipsum dolor sit amet, ei mei} \\
& paulo tation honestatis,
intellegam accommodare ne vim, ut \\
& mel solum putant atomorum. Posse & dolores has ut, \\
prompta & disputando & ne mel, ne
\& viderer ceteros vel. \\
& No petentium
\end{tabular}
\begin{table}[tbp]
\begin{tabular}{llll}
\multicolumn{4}{c}{Lorem ipsum dolor sit amet, ei mei} \\
& paulo tation honestatis,
intellegam accommodare ne vim, ut \\
& mel solum putant atomorum. Posse & dolores has ut, \\
prompta & disputando & ne mel, ne
\& viderer ceteros vel. \\
& No petentium
\end{tabular}
\end{table}
\end{document}

View File

@@ -0,0 +1,49 @@
;; -*- emacs-lisp -*-
;; Copyright (C) 2017 Free Software Foundation, Inc.
;; This file is part of AUCTeX.
;; AUCTeX is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; AUCTeX is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with AUCTeX; see the file COPYING. If not, write to the Free
;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
;; 02110-1301, USA.
;;; Commentary:
;; This file provides some functions and .
;; It has an .emacs-lisp extension because it makes the Makefile easier!
;;; Code:
(require 'tex)
;; Add the "style/" directory to `TeX-style-path',
;; so we can load style files inside tests.
(add-to-list 'TeX-style-path
(expand-file-name "../style"
(when load-file-name
(file-name-directory load-file-name))))
(defun AUCTeX-set-ert-path (&rest sym-val)
"Set first element of SYM-VAL to the next one, and so on.
The value is the path to the test file, make sure it is expanded
in the right directory even when the ERT test from the command
line and from another directory."
(while sym-val
(set (pop sym-val)
(expand-file-name (pop sym-val)
(when load-file-name
(file-name-directory load-file-name))))))

View File

@@ -0,0 +1,87 @@
;;; command-expansion.el --- tests for TeX command expansion
;; Copyright (C) 2014 Free Software Foundation, Inc.
;; This file is part of AUCTeX.
;; AUCTeX is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; AUCTeX is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with AUCTeX; see the file COPYING. If not, write to the Free
;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
;; 02110-1301, USA.
;;; Code:
(require 'ert)
(require 'tex-buf)
(ert-deftest TeX-command-expansion ()
"Check whether \"%%%%\" is correctly expanded when before \"%`\"."
(should (string=
(let ((TeX-command-list
(list (cons "Test" '("%%%% %`%'" TeX-run-command t t)))))
(TeX-command-expand (nth 1 (assoc "Test" TeX-command-list))
'TeX-master-file))
"%% \"\\input\"")))
(ert-deftest TeX-command-expansion-errors ()
"Test error handling in `TeX-command-expand'."
(should-error
;; This error is actually thrown by `TeX-engine-in-engine-alist', but we want
;; to be sure that `TeX-command-expand' fails when the engine is not valid.
(let ((TeX-engine 'non-existing-engine))
(TeX-command-expand "%l" 'TeX-master-file))))
(ert-deftest TeX-view-command-raw-errors ()
"Tests to trigger errors in `TeX-view-command-raw'."
;; Viewer specification should be either a command line string or a Lisp
;; function name to be executed. This test makes sure that the functions
;; throws an error if the selected viewer has a wrong specification (for
;; example a function call, not the function name) such that the returned
;; value `command' isn't a string. This prevents an infinite loop in
;; `TeX-command-expand'.
(should-error
(with-temp-buffer
(let ((TeX-view-program-list '(("viewer"
(wrong-specification))))
(TeX-view-program-selection
'((output-pdf "viewer"))))
(TeX-mode)
(TeX-view-command-raw)))
:type 'error)
;; Signal an error when a nonexistent viewer is selected.
(should-error
(with-temp-buffer
(let ((TeX-view-program-selection
'((output-pdf "does-not-exist"))))
(TeX-mode)
(TeX-view-command-raw)))
:type 'error)
;; Signal an error if the binary associated to the viewer cannot be found.
(should-error
(with-temp-buffer
(let ((TeX-view-program-list
'(("viewer" "viewer %o" "**this-program-does-not-exist**")))
(TeX-view-program-selection
'((output-pdf "viewer"))))
(TeX-mode)
(TeX-view-command-raw)))
:type 'error)
;; Error if there is no selected viewer for current buffer.
(should-error
(with-temp-buffer
(let (TeX-view-program-selection)
(TeX-mode)
(TeX-view-command-raw)))
:type 'error))
;;; command-expansion.el ends here

View File

@@ -0,0 +1,72 @@
(./test.tex (./nice-class.cls
Document Class: nice-class 1970/01/01 v42 A good class
Package nice-class Warning: ******************************************
(nice-class) * THIS IS JUST A WARNING WITH A PESKY
(nice-class) * UNMATCHED CLOSED PARENTHESIS :-)
(nice-class) ****************************************** on input line 32.
)
(/opt/texlive/2015/texmf-dist/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
)
./test.tex:2: Class nice-class Error: ***********************************
(nice-class) * This is a very bad error!
(nice-class) ************************************.
See the suftesi class documentation for explanation.
Type H <return> for immediate help.
...
l.2 \begin{document}
(/other/packages/loaded.sty)
ABD: EveryShipout initializing macros
Package foo Warning: This is a warning! on input line 3.
[1{/opt/texlive/2015/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./test.aux)
(./secondary-file.tex [8] [9] [10 <./path/to/file>]
Underfull \hbox (badness 6608) in paragraph at lines 131--132
[]|\T1/jkpl/m/n/10.95 (+20) Something bla
[11] [12])
LaTeX Warning: Reference `wrong' on page 1 undefined on input line 4.
LaTeX Font Warning: Font shape `OML/cmm/b/it' in size <5.5> not available
(Font) size <5> substituted on input line 70.
[1{/opt/texlive/2015/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./test.aux)
(./test.lof
Underfull \vbox (badness 1048) has occurred while \output is active [7]
Overfull \hbox (0.93071pt too wide) detected at line 31
[]\T1/jkpl/m/n/10.95 144
)
(./file name/with spaces.tex
chapter 5.
<use image/an_image.pdf> [82] [83 <./image/an_image.pdf>] [84] [85] [86] (./image/another.tex
<image/another.pdf, id=1357, 208.78pt x 146.5475pt> <use image/another.pdf>)
<image/another2.pdf, id=1358, 542.025pt x 481.8pt> <use image/another2.pdf>
Underfull \vbox (badness 3942) has occurred while \output is active [87 <./image/another.pdf> <./image/another2.pdf>] [88] (./image/beta.tex
<image/beta.pdf, id=1410, 289.08pt x 201.75375pt>
<use image/beta.pdf>) [89] [90 <./image/beta.pdf>]
Overfull \hbox (13.59138pt too wide) in paragraph at lines 367--368
[]\T1/pplj/m/n/10.95 Un qua-dri-vet-to-re co-va-rian-te $\OMS/zplm/m/n/10.95 f\OML/zplm/m/it/10.95 A[]\OMS/zplm/m/n/10.95 g$ \T1/pplj/m/n/10.95 e un in-sie-me di quat-tro quan-ti-ta $\OT1/zplm/m/n/10.95 (\OML/zplm/m/it/10.95 A[]; A[]; A[]; A[]\OT1/zplm/m/n/10.95 )$
[91] [92]
[93])
! Undefined control sequence.
l.11 \doesnotexist
(./foo.aux) )
LaTeX Warning: Citation 'Knuth:TeXbook-1984' undefined on input line 48.
LaTeX Warning: There were undefined references.
)

View File

@@ -0,0 +1,153 @@
;;; error-parsing.el --- tests for error parsing
;; Copyright (C) 2016 Free Software Foundation, Inc.
;; This file is part of AUCTeX.
;; AUCTeX is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; AUCTeX is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with AUCTeX; see the file COPYING. If not, write to the Free
;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
;; 02110-1301, USA.
;;; Code:
(require 'ert)
(require 'tex-buf)
(AUCTeX-set-ert-path
'TeX-test-compilation-log
"compilation-log.txt")
(ert-deftest TeX-error-parsing ()
"Test error parsing functions."
(should (equal
(with-temp-buffer
(setq TeX-debug-warnings t
TeX-debug-bad-boxes t)
(insert-file-contents TeX-test-compilation-log)
(TeX-parse-all-errors)
TeX-error-list)
'((warning
"./nice-class.cls" 32
"Package nice-class Warning: ******************************************"
0
"Package nice-class Warning: ******************************************
(nice-class) * THIS IS JUST A WARNING WITH A PESKY
(nice-class) * UNMATCHED CLOSED PARENTHESIS :-)
(nice-class) ****************************************** on input line 32.\n"
nil 32 nil 376 nil)
(error
"./test.tex" 2
"Class nice-class Error: ***********************************" 0
"\n(nice-class) * This is a very bad error!
(nice-class) ************************************.
See the suftesi class documentation for explanation.
Type H <return> for immediate help.
...
l.2 \\begin{document}
(/other/packages/loaded.sty)
ABD: EveryShipout initializing macros"
"\\begin{document}\n\n(/other/packages/loaded.sty)" nil nil 971 nil)
(warning "./test.tex" 3
"Package foo Warning: This is a warning! on input line 3." 0
"Package foo Warning: This is a warning! on input line 3.\n"
nil 3 nil 1030 nil)
(bad-box
"./secondary-file.tex" 131
"Underfull \\hbox (badness 6608) in paragraph at lines 131--132"
0 "\n[]|\\T1/jkpl/m/n/10.95 (+20) Something bla" "bla"
132 t 1268 nil)
(warning "./test.tex" 4
"LaTeX Warning: Reference `wrong' on page 1 undefined on input line 4."
0
"LaTeX Warning: Reference `wrong' on page 1 undefined on input line 4.\n"
"wrong" 4 nil 1351 nil)
(warning "./test.tex" 70 "LaTeX Font Warning: Font shape `OML/cmm/b/it' in size <5.5> not available"
0 "LaTeX Font Warning: Font shape `OML/cmm/b/it' in size <5.5> not available
(Font) size <5> substituted on input line 70.\n" nil 70 nil 1485 nil)
(bad-box "./test.lof" nil "Underfull \\vbox (badness 1048) has occurred while \\output is active [7]"
0 "\nUnderfull \\vbox (badness 1048) has occurred while \\output is active [7]"
nil nil t 1651 nil)
;; It is possible there are two different bad box warnings in two
;; consecutive lines (for example it happens if the first one is a
;; vertical bad box which doesn't provide additional information),
;; this test makes sure the second warning is not mistaken as
;; context of the first one.
(bad-box "./test.lof" 31 "Overfull \\hbox (0.93071pt too wide) detected at line 31"
0 "\n []\\T1/jkpl/m/n/10.95 144" "144" 31 t 1733 nil)
;; The line of this warning ends with a new file opened. This test
;; makes sure point stays exactly at the end of the warning so that
;; the next the next warning in the list has the right file
;; (otherwise it would be nil).
(bad-box "./file name/with spaces.tex" nil "Underfull \\vbox (badness 3942) has occurred while \\output is active [87 <./image/another.pdf> <./image/another2.pdf>]"
0 "\nUnderfull \\vbox (badness 3942) has occurred while \\output is active [87 <./image/another.pdf> <./image/another2.pdf>]"
nil nil t 2142 nil)
(bad-box "./file name/with spaces.tex" 367 "Overfull \\hbox (13.59138pt too wide) in paragraph at lines 367--368"
0 "\n[]\\T1/pplj/m/n/10.95 Un qua-dri-vet-to-re co-va-rian-te $\\OMS/zplm/m/n/10.95 f\\OML/zplm/m/it/10.95 A[]\\OMS/zplm/m/n/10.95 g$ \\T1/pplj/m/n/10.95 e un in-sie-me di quat-tro quan-ti-ta $\\OT1/zplm/m/n/10.95 (\\OML/zplm/m/it/10.95 A[]; A[]; A[]; A[]\\OT1/zplm/m/n/10.95 )$" "$"
368 t 2600 nil)
(error "./test.tex" 11 "Undefined control sequence." 0
"\nl.11 \\doesnotexist\n\n(./foo.aux) )"
"\\doesnotexist\n" nil nil 2682 nil)
(warning "./test.tex" 48
"LaTeX Warning: Citation 'Knuth:TeXbook-1984' undefined on input line 48." 0
"LaTeX Warning: Citation 'Knuth:TeXbook-1984' undefined on input line 48.\n"
"Knuth:TeXbook-1984" 48 nil 2756 nil)
(warning "./test.tex" nil "LaTeX Warning: There were undefined references."
0 "LaTeX Warning: There were undefined references.\n" nil nil nil 2805 nil)
))))
(ert-deftest TeX-error-parsing-expl3-warnings ()
"Test parsing of expl3 warnings."
(should (equal
(with-temp-buffer
(setq TeX-debug-warnings t
TeX-debug-bad-boxes t)
(insert
"*************************************************
* xsim warning: \"rerun\"
*
* Exercise properties may have changed. Rerun to get them synchronized.
*************************************************
")
(TeX-parse-all-errors)
TeX-error-list)
'((warning nil nil "* xsim warning: \"rerun\"" 0
"* xsim warning: \"rerun\"\n* \n* Exercise properties may have changed. Rerun to get them synchronized.\n*************************************************\n"
nil nil nil 200 nil)))))
;; See https://lists.gnu.org/archive/html/auctex/2017-04/msg00007.html.
(ert-deftest TeX-LaTeX2e-date ()
"Test parsing of different LaTeX2e date formats."
(should
(equal
(with-temp-buffer
(insert "LaTeX2e <2017-04-15>")
(goto-char (point-min))
(let ((TeX-command-buffer (buffer-name)))
(TeX-LaTeX-sentinel nil "LaTeX")
TeX-command-next))
"View"))
(should
(equal
(with-temp-buffer
(insert "LaTeX2e <2017/01/01> patch level 3")
(goto-char (point-min))
(let ((TeX-command-buffer (buffer-name)))
(TeX-LaTeX-sentinel nil "LaTeX")
TeX-command-next))
"View")))
;;; error-parsing.el ends here

View File

@@ -0,0 +1,35 @@
;;; path-expansion.el --- tests for path expansion
;; Copyright (C) 2017 Free Software Foundation, Inc.
;; This file is part of AUCTeX.
;; AUCTeX is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; AUCTeX is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with AUCTeX; see the file COPYING. If not, write to the Free
;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
;; 02110-1301, USA.
;;; Code:
(require 'ert)
(ert-deftest TeX-variable-truncation ()
"Check whether list variable is not truncated as side effect."
(let ((var '("str1" "str2"))
(TeX-kpathsea-path-delimiter nil)
(TeX-search-files-type-alist
'((abc "${dummy}" ("str2" var) TeX-file-extensions))))
(TeX-search-files-by-type 'abc 'global)
(should (equal var '("str1" "str2")))))
;;; command-expansion.el ends here

View File

@@ -0,0 +1,31 @@
;;; utility.el --- tests for AUCTeX utility functions
;; Copyright (C) 2017 Free Software Foundation, Inc.
;; This file is part of AUCTeX.
;; AUCTeX is free software; you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; AUCTeX is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with AUCTeX; see the file COPYING. If not, write to the Free
;; Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
;; 02110-1301, USA.
;;; Code:
(require 'ert)
(ert-deftest TeX-infinite-loop ()
"Check whether functions don't fall into infinite loop."
(should (TeX-delete-duplicate-strings '("nil")))
(should (TeX-delete-dups-by-car '(("nil" . 1)))))
;;; utility.el ends here