expl3:查看提前查看的标记

expl3:查看提前查看的标记

使用expl3,我可以\peek_charcode:NTF。对于调试,我希望实际看到循环每次迭代的预览标记,但在文档中没有看到合适的标记变量。

答案1

有关的文档\peek_after:Nw表明所查看的令牌在中可用,\l_peek_token并且这就是以下所有功能(基于\futurelet)的工作原理。

也许文档应该使这一点更清楚。

以下是一个例子:

\documentclass{article}
\usepackage{expl3}
\ExplSyntaxOn
\peek_charcode_remove:NTF  
 B
 { \tl_show:N \l_peek_token } 
 { \tl_show:N \l_peek_token \tl_show:N }  
A

\peek_charcode_remove:NTF   
 B
 { \tl_show:N \l_peek_token } 
 { \tl_show:N \l_peek_token \tl_show:N }  
 B

\ExplSyntaxOff
\stop

以下是日志文件的相关部分:

This is pdfTeX, Version 3.1415926-2.5-1.40.14 (TeX Live 2013) (format=pdflatex 2013.11.14)  14 NOV 2013 21:50
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**peek.tex
(./peek.tex
LaTeX2e <2011/06/27>

[...]

> \l_peek_token=the letter A.
<recently read> }

l.8 A

? 
> A=the letter A.
<recently read> }

l.8 A

? 
> \l_peek_token=the letter B.
<recently read> }

l.14  B

? 
 ) 
Here is how much of TeX's memory you used:
 5223 strings out of 493308
 95482 string characters out of 6137815
 131918 words of memory out of 5000000
 8695 multiletter control sequences out of 15000+600000
 3640 words of font info for 14 fonts, out of 8000000 for 9000
 957 hyphenation exceptions out of 8191
 31i,1n,33p,203b,85s stack positions out of 5000i,500n,10000p,200000b,80000s

No pages of output.
PDF statistics:
 0 PDF objects out of 1000 (max. 8388607)
 0 named destinations out of 1000 (max. 500000)
 1 words of extra memory for PDF output out of 10000 (max. 10000000)

由于我\peek_charcode_remove:NTF仅使用了出现两次的意思A

相关内容