2

I'm learning how to use package cutwin. I copy the code in https://tex.stackexchange.com/a/74702/247085:

\documentclass{book}
\usepackage{amsthm}
\usepackage{cutwin}
\usepackage{lipsum}
\theoremstyle{plain}
\newtheorem{thm}{Theorem}
\begin{document}
\renewcommand\windowpagestuff{\rule{2cm}{2cm}}
\opencutleft
\begin{thm}
\begin{cutout}{2}{0pt}{\dimexpr\linewidth-2.5cm\relax}{6}
    \lipsum[1]
  \end{cutout}
\end{thm}
\end{document} 

but I can't get the same result as in https://tex.stackexchange.com/a/74702/247085, the picture is some lines higher than expected: enter image description here

I'm using TexLive 2021, compiling the above code via XeLaTeX.

2
  • Welcome to TeX.SE!
    – Mensch
    Commented Oct 12, 2021 at 13:58
  • updated cutwin now at ctan Commented Oct 31, 2021 at 22:13

2 Answers 2

7

An updated cutwin is now available on ctan (2021-10-31) and will be in tex distributions shortly, so the original answer below is no longer applicable.


Cutwin apparently needs some updates (An interaction with the new picture mode implementation in latex) until then you can roll the format back to a compatible version

enter image description here

\RequirePackage[2020/02/08]{latexrelease}
\documentclass{book}
\usepackage{amsthm}
\usepackage{cutwin}
\usepackage{lipsum}
\theoremstyle{plain}
\newtheorem{thm}{Theorem}
\begin{document}
\renewcommand\windowpagestuff{\rule{2cm}{2cm}}
\opencutleft
\begin{thm}
\begin{cutout}{2}{0pt}{\dimexpr\linewidth-2.5cm\relax}{6}
    \lipsum[1]
  \end{cutout}
\end{thm}
\end{document}
4

Update 2021-10-31

cutwin has been updated on ctan and the patch is no longer needed


Old Answer

cutwin uses the length \@tempdimc in two places without being able to be sure that it isn't changed between the two uses -- and picture now does exactly this. The code works again if cutwin uses its own temporary length:

\documentclass{book}
\usepackage{amsthm}
\usepackage{cutwin}
\usepackage{etoolbox}
\makeatletter
\newlength\cut@tempdimc
% patch twice:
\patchcmd\pageinwindow{\@tempdimc}{\cut@tempdimc}{}{\fail}
\patchcmd\pageinwindow{\@tempdimc}{\cut@tempdimc}{}{\fail}
\usepackage{lipsum}
\theoremstyle{plain}
\newtheorem{thm}{Theorem}
\begin{document}
\renewcommand\windowpagestuff{\rule{2cm}{2cm}}
\opencutleft
\begin{thm}
\begin{cutout}{2}{0pt}{\dimexpr\linewidth-2.5cm\relax}{6}
    \lipsum[1]
  \end{cutout}
\end{thm}
\end{document}

This is a clear bug in cutwin (and it should change its use of \@tempdimb too, this isn't safe either).

7
  • I am unable any longer to support the cutwin (or any other of my packages/classes). Is anyone willing to take them over? Commented Oct 13, 2021 at 17:25
  • @PeterWilson thanks, in this case we might change latex again so as not to affect cutwin or we could with the above permision make the register rename in cutwin and upload to ctan Commented Oct 13, 2021 at 18:22
  • @PeterWilson I have a fixed version here that I could push to ctan github.com/davidcarlisle/cutwin Commented Oct 13, 2021 at 22:26
  • @DavidCarlisle Thank you kindly. You have my permission to do what you think is best (but it seems a bit drastic to change latex because of an old package, unless other packages are, or maybe, also affected by the latex upgrade). Commented Oct 14, 2021 at 17:16
  • @PeterWilson well it's always a slight question with \@tempwhatever names if two things both use the same register who to blame but the suggested change in that github link just renames the register at cutwin so wouldn't need a chanege in latex Commented Oct 14, 2021 at 17:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .