1

Trying to execute @DavidCarlisle code I still having errors

! Missing number, treated as zero. \ l.21 ...{5cm}{4}{10pt}{2cm}{1}{5cm}{8cm}\ \lipsum[ 1] 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 = inserted for \ifnum. \ l.21 ...{5cm}{4}{10pt}{2cm}{1}{5cm}{8cm}\ \lipsum[ 1] I was expecting to see '<', '=', or '>'. Didn't.

\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}

Note that I have texlive 2016, any suggestions.

Bobyandbob
  • 4,899
Salim Bou
  • 17,021
  • 2
  • 31
  • 76
  • There has crept some typing error in that answer. \ \lipsum[1] had to be \\\lipsum[1]. Meaning the \newparshape ends with \\\ and then the text follows. I have made that correction in the original code by @DavidCarlisle and in your code above. – Pieter van Oostrum Dec 21 '16 at 11:33
  • 1
    @PietvanOostrum I happened to see some code of mine that strangely ending up here with “backslash space” instead of “double backslash” (and caused errors to the user trying to use it, of course). I don't know how and when the mistake crept in, though. :(. A tip: for getting a double backslash in comments, use “double backquote, double backslash, double backquote”: \\ – egreg Dec 21 '16 at 11:45
  • @PietvanOostrum That is definitely an answer to this question. – Henri Menke Dec 21 '16 at 16:40
  • @egreg Is this the site bug? – cfr Dec 22 '17 at 22:57
  • 5
    I'm voting to close this question as off-topic because the issue is due to copying code corrupted by the infamous \ site bug – egreg Dec 22 '17 at 23:00
  • @cfr I think so; since the original code has since been fixed, this question is now useless. – egreg Dec 22 '17 at 23:02

0 Answers0