Closed claell closed 6 months ago
The Changepage package is not supported yet, but it is not too hard to add support for this. Try this configuration file, changepage.4ht
:
\NewConfigure{adjustwidth}{2}
\def\:tempa#1#2{%
\def\adjustwidth:left{#1}%
\def\adjustwidth:right{#2}%
\a:adjustwidth%
}
\HLet\adjustwidth\:tempa
\expandafter\HLet\csname adjustwidth*\endcsname\:tempa
\def\:tempa{\b:adjustwidth}
\HLet\endadjustwidth\:tempa
\expandafter\HLet\csname endadjustwidth*\endcsname\:tempa
\def\pt:to:em#1{\strip@pt\dimexpr#1/\f@size em}
\Configure{adjustwidth}{\ifvmode\IgnorePar\fi\EndP\HCode{<div class="ajdustwidth" style="margin-left:\pt:to:em\adjustwidth:left;margin-right:\pt:to:em\adjustwidth:right;">}\par\ShowPar}{\ifvmode\IgnorePar\fi\EndP\HCode{</div>}}
\Hinput{changepage}
\endinput
Thanks again! I'll need to look into using such config files!
As a side note: Might it be sensible to print warnings in case unsupported packages are found? That way, the user knows that something isn't (or might not be) working as expected.
As a side note: Might it be sensible to print warnings in case unsupported packages are found? That way, the user knows that something isn't (or might not be) working as expected.
The problem is that some packages may not work properly even if they are supported. Something can break in every package update. So such warning could be misleading :)
Mh, I partly understand where you are coming from (people thinking that everything is fine as long as there is no warning), but think no warning at all is worse. One can probably structure the warning in a way that it also tells that simply changing things until the warning is gone is no guarantee that now everything is perfect with the generated document.
OK, I've added this feature to make4ht
, but only as an info message, so you will need to use -a debug
or -a info
options to print them.
On this example I get:
$ make4th -m draft -a info sample.tex
[INFO] mkparams: Output dir:
[INFO] mkparams: Compiler: latex
[INFO] mkparams: Latex options: -jobname='sample'
[INFO] mkparams: tex4ht.sty: xhtml,,charset=utf-8
[INFO] mkparams: tex4ht: -cmozhtf -utf8
[INFO] mkparams: build_file: sample.mk4
[INFO] mkparams: Output format: html5
[STATUS] make4ht: Conversion started
[STATUS] make4ht: Input file: sample.tex
[INFO] mkutils: Load extension common_domfilters
[INFO] mkutils: Cannot open config file sample.mk4
[INFO] make4ht-lib: setting param correct_exit
[INFO] make4ht-lib: Adding: ext dvi
[INFO] htlatex: LaTeX call: latex --interaction=batchmode -jobname='sample' '\makeatletter\def\HCode{\futurelet\HCode\HChar}\def\HChar{\ifx"\HCode\def\HCode"##1"{\Link##1}\expandafter\HCode\else\expandafter\Link\fi}\def\Link#1.a.b.c.{\let\HCode\documentstyle\def\documentstyle{\let\documentstyle\HCode\expandafter\def\csname tex4ht\endcsname{#1,html}\def\HCode####1{\documentstyle[tex4ht,}\@ifnextchar[{\HCode}{\documentstyle[tex4ht]}}\RequirePackage[#1,html]{tex4ht}}\makeatother\HCode xhtml,,charset=utf-8,html5.a.b.c.\input "\detokenize{sample.tex}"' > /dev/null 2>&1
[INFO] htlatex: Unsupported file: expl3.sty
[INFO] htlatex: Unsupported file: l3keys2e.sty
[INFO] htlatex: Unsupported file: lipsum.sty
[INFO] htlatex: Unsupported file: changepage.sty
[INFO] mkutils: xhtml,charset=utf-8,html5,html
[INFO] mkutils: executing: tex4ht -cmozhtf -utf8 "sample.dvi"
[INFO] mkutils: executing: t4ht "sample.dvi"
[INFO] mkutils: Parse LG
[INFO] make4ht-lib: parse_lg process file: sample.html
[INFO] make4ht-lib: parse_lg process file: sample.html
[INFO] make4ht: No output directory
[INFO] make4ht-lib: parse_lg process file: sample.css
[INFO] make4ht: No output directory
[INFO] make4ht-lib: parse_lg process file: sample.tmp
[INFO] make4ht-lib: tmp file
[STATUS] make4ht: Conversion finished
See the [INFO] htlatex: Unsupported file:
messages.
I just tested again after updating make4ht
. It seems that this is now supported by the package, and I don't need to manually use a configuration file, anymore? 😄
@claell Yes, the support for adjustwidth
is now built into TeX4ht.
Closing this, then! Thanks again!
I noticed that the right margins set with
adjustwidth
don't seem to get respected.Also, are the left margins constant or is the actual margin value taken into consideration? It doesn't seem to have an effect for me.
MWE:
PDF:
EPUP in Calibre Viewer: