在 texlive 2016 中执行 \parshape 代码时出错

在 texlive 2016 中执行 \parshape 代码时出错

尝试执行@DavidCarlisle代码我仍然有错误

!缺失数字,视为零。\ l.21 ...{5cm}{4}{10pt}{2cm}{1}{5cm}{8cm}\ \lipsum[ 1] 这里应该有一个数字;我插入了“0”。(如果您不明白我为什么需要看到一个数字,请在 TeXbook 索引中查找“奇怪的错误”。)

!\ifnum 中缺少插入 =。\ l.21 ...{5cm}{4}{10pt}{2cm}{1}{5cm}{8cm}\ \lipsum[ 1] 我原本以为会看到“<”、“=”或“>”。但并没有看到。

\documentclass{article}
\usepackage{lipsum}% http://ctan.org/pkg/lipsum

\parindent0pt
\parskip\bigskipamount

\makeatletter
\def\newparshape{\parshape\@npshape0{}}
\def\@npshape#1#2#3{\ifx\\#3\expandafter\@@@npshape\else\expandafter\@@npshape\fi
{#1}{#2}{#3}}
\def\@@npshape#1#2#3#4#5{%
\ifnum#3>\z@\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
{\expandafter\@@npshape\expandafter{\the\numexpr#1+1\relax}{#2 #4 #5}{\numexpr#3-1\relax}{#4}{#5}}%
{\@npshape{#1}{#2}}}
\def\@@@npshape#1#2#3{#1 #2 }
\makeatother

\begin{document}

\newparshape{3}{5pt}{5cm}{4}{10pt}{2cm}{1}{5cm}{8cm}\\\lipsum[1]

\newparshape{2}{5cm}{5cm}{2}{4cm}{5cm}{2}{3cm}{5cm}{1}{0pt}{\textwidth}\\\lipsum[1]

\end{document}

请注意我有texlive 2016任何建议。

相关内容