-
Notifications
You must be signed in to change notification settings - Fork 33
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
Add support for \addvspace
#130
Comments
I've realized that there is a bug in \def\pt:to:em#1{\strip@pt\dimexpr#1/\f@size em}
\renewcommand\epubaddvspace[1]{\edef\:vspacesize{\pt:to:em{#1}}\a:epubaddvspace}
\NewConfigure{epubaddvspace}{1}
\Configure{epubaddvspace}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="addvspace" style="height:\:vspacesize">}\HCode{</div>}\par}
\Css{.addvspace + p{margin-top:0pt;}}
\Css{p + .addvspace{margin-top:0pt;}}
\Css{.addvspace + .addvspace{height:0;margin:0;}} Regarding the issue with multiple spaces, I forgot that we set explicitly the height using inline styles. This overwrites anything that is written in the CSS file. In this case, I think it is best to use a Lua build file that will remove extra spaces: local domfilter = require "make4ht-domfilter"
local process = domfilter {
function(dom)
for _, vspace in ipairs(dom:query_selector(".addvspace + .addvspace")) do
vspace:remove_node()
end
return dom
end
}
Make:match("html$", process)
Compile using
|
What is the effect of (not) starting a paragraph in the command? I also noticed that you removed the non-breaking space. I already wondered whether it should be there, before. With the additional Lua build file, it works for me, now! |
It caused the build file to work incorrectly, because it detected two vspaces as following each other even if there was a text between them. Paragraph element is needed to prevent that. |
Continuation from #125 to not make that issue too long and keep discussions on different topics easier to follow.
Originally posted by @michal-h21 in #125 (comment)
Thanks! I had a similar idea after thinking about it again.
Unfortunately, after testing, it doesn't work as expected.
I also created a MWE, as this seems to be needed. 🙂
LaTeX:
Style:
.4ht
file:Command to invoke
tex4ebook
Result PDF:
Result EPUB:
Also, as general note: This won't work as
\addvspace
, which would use the biggest space, and not the first one (as this example does IMHO). For me, that is not a problem, as subsequent spaces would have the same height (at least currently). But just as a note.The text was updated successfully, but these errors were encountered: