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

\vskip should always(?) break the line #2469

Open
xworld21 opened this issue Jan 1, 2025 · 1 comment
Open

\vskip should always(?) break the line #2469

xworld21 opened this issue Jan 1, 2025 · 1 comment
Assignees
Milestone

Comments

@xworld21
Copy link
Contributor

xworld21 commented Jan 1, 2025

This normally compiles to two lines

\documentclass{article}
\begin{document}
First line
\vskip0.01em
second line
\end{document}

but LaTeXML does not add a line break because of

DefConstructor('\vskip Glue', sub {
my ($document, $length) = @_;
$length = $length->ptValue;
if ($length > 10) { # Or what!?!?!?!
if ($document->isCloseable('ltx:para')) {
$document->closeElement('ltx:para'); }
elsif ($document->isOpenable('ltx:break')) {
$document->insertElement('ltx:break'); } }
return; },
properties => sub { (height => $_[1], isSpace => 1,, isSkip => 1, isVerticalSpace => 1, isBreak => 1); });

Checking for > 10 is very intentional, obviously, but why is that?

@xworld21
Copy link
Contributor Author

xworld21 commented Jan 1, 2025

Some clarification: \vskip always switches to vertical mode. I suspect the >10 test has more to do with \vspace

DefMacro('\vspace OptionalMatch:* {}', '\vskip #2\relax');

The problem is that \vspace is the same as \vskip only in vertical mode. In horizontal mode, it shifts the line spacing (https://tex.stackexchange.com/a/30065). I suggest: \vskip removes the >10 test and adds margin-bottom to the previous block, \vspace instead checks if it is 'horizontal mode' (same test as for ltx:inline-block vs ltx:block) and if so inserts an inline-block with margin/vertical-align/??? to dynamically affect the space on the current line.

We were just talking about distinguishing vertical vs horizontal mode... should there be a common function isVertical somewhere?

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

No branches or pull requests

3 participants