Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The cutwin package generates bad vertical spacings #1

Open
hair-splitter opened this issue Nov 1, 2021 · 4 comments
Open

The cutwin package generates bad vertical spacings #1

hair-splitter opened this issue Nov 1, 2021 · 4 comments

Comments

@hair-splitter
Copy link

I have a problem with the cutwin package. See the next MWE:

\documentclass[12pt]{article}
\usepackage{cutwin,lipsum}
\begin{document}
\opencutcenter
\begin{cutout}{4}{5cm}{5cm}{5}
\lipsum[1]
\end{cutout}
\end{document}

As you can see, the marked spacings are different:

cutwin

@u-fischer
Copy link
Collaborator

Well yes, that is a quite old bug, you can find various variants if you search a bit. cutwin splits the paragraph into three boxes which it then outputs again. But its guesses about the needed glue between these boxes is often wrong. It is not so obvious in your example but also the spacing at the top of the window is not right.

Your best bet is probably to set the two shifts cutwin uses to 0 and to add a \strut in various places:

\documentclass[12pt]{article}
\usepackage{cutwin}

\ExplSyntaxOn
\newcommand\manyx[2]{\int_step_inline:nn{#1}{#2\c_space_tl}}
\ExplSyntaxOff
\begin{document}

\makeatletter
\renewcommand*{\c@twcalcilg}{\c@twvsilg=0pt }

\renewcommand*{\c@twcalcshift}{\c@twvsilg=0pt }
\makeatother


\section{with strut}

\begin{cutout}{4}{5cm}{5cm}{5}
\manyx{400}{\strut--}
\end{cutout}

\end{document}

image

@hair-splitter
Copy link
Author

Thank you very much! Although this solution does not work correctly with normal text (or \lipsum[1]).

@u-fischer
Copy link
Collaborator

well no, it won't work with \lipsum. But with normal text it should be okay (but it requires a bit manual work to insert \strut in the relevant lines).

@hair-splitter
Copy link
Author

Indeed, if I use \strut in the relevant lines, then the vertical spacings will be correct. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants