我们有一些为 Texlive 2013 设计的 LaTeX,但我们将转向 Texlive 2017(因为 Ubuntu 14 EOL)。
我们使用该gridset
包来帮助我们将文本对齐到网格,并且(在调试时)我们tikz
在页面上绘制网格来检查网格对齐。
这在 Texlive 2013 和 2015 中运行良好,但在 Texlive 2017 中会失效。删除后会tikz
编译gridset
fine。删除后会gridset
编译tikz
fine,但一起使用会导致编译失败。
一个简单的例子如下:
\documentclass{article}
% Let gridset work with newer versions of LuaLaTeX
\usepackage{luatex85}
% We have to redefine \savepos because there's a name clash
% between a LuaLaTeX primitive and a gridset macro
\let\savepos=\relax
\usepackage{gridset}
\usepackage{tikz}
\usepackage{eso-pic}
% Draw the baseline grid
\AddToShipoutPicture{\AtTextLowerLeft{
\begin{tikzpicture}[overlay,remember picture]%
\draw[
red!50!white,
very thin,
ystep=\baselineskip,
xstep=\textwidth,
yshift=2pt, % manual adjustment to match baseline
]%
(0, 0) grid (\textwidth, \textheight);%
\end{tikzpicture}%
}}%
\begin{document}
\vskipnextgrid % start aligned to grid
Foo
\par\vspace{5pt} % force us off the grid
\vskipnextgrid % force us back onto the grid
Bar
\end{document}
编译失败,出现以下错误:
! Missing \endcsname inserted.
<to be read again>
\edef
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Missing \endcsname inserted.
<to be read again>
\edef
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Package gridset Error: position `\edef ' is not unique.
See the gridset package documentation for explanation.
Type H <return> for immediate help.
...
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
You have used the position name `\edef ' you are using on page `1'
already on page `\pos@ \edef @page\endcsname '.
You should stop processing, remove the aux-files and correct the names.
If you'd continue, this will result in grid position failures,
that won't be reported!
! Missing \endcsname inserted.
<to be read again>
\edef
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Missing \endcsname inserted.
<to be read again>
\edef
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Missing \endcsname inserted.
<to be read again>
\edef
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Missing \endcsname inserted.
<to be read again>
\edef
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Missing \endcsname inserted.
<to be read again>
\edef
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Missing \endcsname inserted.
<to be read again>
\edef
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Use of \pos@ doesn't match its definition.
<argument> pos@\edef @b
ase
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.
! Missing number, treated as zero.
<to be read again>
a
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! LaTeX Error: Missing \begin{document}.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
You're in trouble here. Try typing <return> to proceed.
If that doesn't work, type X <return> to quit.
! Extra \endcsname.
\@nameuse #1->\csname #1\endcsname
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
I'm ignoring this, since I wasn't doing a \csname.
! Missing \endcsname inserted.
<to be read again>
\edef
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Missing \endcsname inserted.
<to be read again>
\edef
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Use of \pos@ doesn't match its definition.
<argument> pos@\edef @i
nterval
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.
! Missing number, treated as zero.
<to be read again>
n
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Extra \endcsname.
\@nameuse #1->\csname #1\endcsname
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
I'm ignoring this, since I wasn't doing a \csname.
! Missing \endcsname inserted.
<to be read again>
\edef
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Use of \pos@ doesn't match its definition.
<argument> pos@\edef @i
nterval
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.
! Missing number, treated as zero.
<to be read again>
n
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Arithmetic overflow.
<to be read again>
n
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
I can't carry out that multiplication or division,
since the result is out of range.
! Extra \endcsname.
\@nameuse #1->\csname #1\endcsname
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
I'm ignoring this, since I wasn't doing a \csname.
! Missing \endcsname inserted.
<to be read again>
\edef
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Missing \endcsname inserted.
<to be read again>
\edef
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Use of \pos@ doesn't match its definition.
<argument> pos@\edef @i
nterval
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.
! Missing number, treated as zero.
<to be read again>
n
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Extra \endcsname.
\@nameuse #1->\csname #1\endcsname
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
I'm ignoring this, since I wasn't doing a \csname.
! Missing \endcsname inserted.
<to be read again>
\edef
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Missing \endcsname inserted.
<to be read again>
\edef
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Use of \pos@ doesn't match its definition.
<argument> pos@\edef @y
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.
! Missing number, treated as zero.
<to be read again>
\endcsname
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Extra \endcsname.
<recently read> \endcsname
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
I'm ignoring this, since I wasn't doing a \csname.
! Missing \endcsname inserted.
<to be read again>
\edef
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Use of \pos@ doesn't match its definition.
<argument> pos@\edef @b
ase
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
If you say, e.g., `\def\a1{...}', then you must always
put `1' after `\a', since control sequence names are
made up of letters only. The macro here has not been
followed by the required stuff, so I'm ignoring it.
! Extra \endcsname.
\@nameuse #1->\csname #1\endcsname
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
I'm ignoring this, since I wasn't doing a \csname.
! Missing number, treated as zero.
<to be read again>
)
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
A number should have been here; I inserted `0'.
(If you can't figure out why I needed to see a number,
look up `weird error' in the index to The TeXbook.)
! Missing \endcsname inserted.
<to be read again>
\edef
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
! Missing control sequence inserted.
<inserted text>
\inaccessible
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
Please don't say `\def cs{...}', say `\def\cs{...}'.
I've inserted an inaccessible control sequence so that your
definition will be completed without mixing me up too badly.
You can recover graciously from this error, if you're
careful; see exercise 27.2 in The TeXbook.
! Missing \endcsname inserted.
<to be read again>
\edef
l.2 ...edef }{1}{46515936}{786432}{9017753}{7844659}
The control sequence marked <to be read again> should
not appear between \csname and \endcsname.
Does anyone have any ideas on how to fix this?
答案1
你可以尝试一下这个补丁。
\let\storedsavepos\savepos
\let\savepos\undefined
\usepackage{gridset}
\let\gridsetsavepos\savepos
\let\savepos\storedsavepos
\usepackage{xpatch}
\xpatchcmd\vskipnextgrid{\savepos}{\gridsetsavepos}{}{\fail}
\xpatchcmd\vskipnextgrid{\savepos}{\gridsetsavepos}{}{\fail}
tikz 的替代补丁是
\usepackage{tikz}
\usepackage{xpatch}
\makeatletter
\xpatchcmd\pgfsys@markposition{\savepos}{\primitive\savepos}{}{\fail}
总的来说,我更喜欢第二种,因为它不会影响记录的用户命令。