Comments (8)
我又试验了下,
将
os.execute("pdftotext -enc " .. pdftotextenc .. " -nopgbrk -layout " .. sourcename .. "_html.pdf " .. sourcename .. "_html.html")
去掉-layout选项,改为
os.execute("pdftotext -enc " .. pdftotextenc .. " -nopgbrk " .. sourcename .. "_html.pdf " .. sourcename .. "_html.html")
可以解决一些错行bug,尚未发现去掉layout选项是否引发其它BUG……
win 10 下面会出现,对我 https://github.com/CTeX-org/forum/issues/18#issuecomment-477279193中 pdf 附件的例子会出现:
有-layout
<!--
<script
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML-full">
</script>
-->
无 -layout
:
<!-<script
src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS_HTML-full">
</script>
-->
这就有问题了。但用你的例子测试未发现问题。另外用 wsl 里面的 pdftotext 我这边对上面所有例子都没发现问题。
对于这个问题,我用 https://github.com/jrmuizel/pdf-extract 里面的例子改了下 做了个 pdf2text,目前用着未发现问题
from forum.
这个@sd44 比较熟,at一下他。
from forum.
重新测试后发现可以定位到更小的例子
lwarp-test_html:
\documentclass[a4paper,10pt]{ctexart}
\usepackage[
mathjax]{lwarp}
\begin{document}
\setcounter{footnote}{10} %% 设置大于等于 10 都可以出现问题
可见\footnote{ Igor R. Shafarevich, Basic Notions of Algebra(p.108), Springer, 2005. 有中译本,《代数基本概念》, 李福安译, 高等教育出版社, 2014年。}。
\end{document}
在 lwarpmk.lua 中的 pdftohtml 函数里面
os.execute("pdftotext -enc " .. pdftotextenc .. " -nopgbrk -layout "
.. sourcename .. "_html.pdf " .. sourcename .. "_html.html")
在命令行里面直接运行
pdftotext -enc UTF-8 -nopgbrk -layout lwarp-test_html.pdf
复现问题。
pdftotext 版本:
pdftotext version 0.75.0
Copyright 2005-2019 The Poppler Developers - http://poppler.freedesktop.org
Copyright 1996-2011 Glyph & Cog, LLC
附上有问题的 pdf 和测试例子 :
lwarp-test_html.pdf
lwarp-test.zip
from forum.
补充一些信息
- 使用下面的命令,便能将 issue 提供的例子从
main.tex
编译到main_html.html
(注意文件不能存成lwarp.tex
,lwarp
不接受)
xelatex main.tex
lwarpmk print
lwarpmk html
- 排查后发现,问题出在
pdftotext
,而和lwarp
无关。
首先,定位到lwarpmk html
这一步。根据lwarp
文档 6.3 节的说明,这一步又分为三个子步骤:main_html.tex -> main_html.pdf
,使用 latexmain_html.pdf -> main_html.html
,使用pdftotext
main_html.html -> 多个 html 文件
,使用 lwarp 自己的功能
继续排查,发现问题出在 ii.(因为 i. 生成的 main_html.pdf
是没问题的)。在 lwarp
文档 40.12 节,能找到 ii. 使用的命令,也就是 @views63 贴出来的那两行。(目前的进度就只到这里)
- 目前得到的关于
pdftotext
的信息
- win 下,
pdftotext
是作为xpdf
功能之一,在安装 texlive 时附带的,texlive 2019 pretest 提供的是pdftotext 0.75.0
,即题主使用的版本 - macOS 下,使用
pdftotext
需要安装poppler
(brew info poppler
),目前最新版为pdftotext 0.74.0
。在我本地,使用0.74.0
无法复现问题。
from forum.
在 wsl 里面的 pdftotext 测试,输出正常。
没有找的关键的触发问题的点。对测试例子:
\documentclass[a4paper,10pt]{ctexart}
\usepackage[
mathjax]{lwarp}
\begin{document}
\setcounter{footnote}{10}
可见\footnote{ Igor R. Shafarevich, Basic Notions of Algebra(p.108), Springer, 2005. 有中译本,《代数基本概念》,}。
\end{document}
修改 \footnote{ Igor R. Shafarevich, Basic Notions of Algebra(p.108), Springer, 2005. 有中译本,《代数基本概念》
为 \footnote{ Igor R. Shafarevich, Basic Notions of Alhebra(p.108), Springer, 2005. 有中译本,《代数基本概念》
(Algebra 中的 g 改为 h)就正常。而对字符调整位置的排列无影响还是出错。
一个临时的解决办法,在 wsl 内安装 poppler-utils,修改 win 下 texlive lwarpmk.lua 中的 pdftohtml 函数:
os.execute("pdftotext -enc " .. pdftotextenc .. " -nopgbrk -layout "
.. sourcename .. "_html.pdf " .. sourcename .. "_html.html")
改为
os.execute("wsl1 pdftotext -enc " .. pdftotextenc .. " -nopgbrk -layout "
.. sourcename .. "_html.pdf " .. sourcename .. "_html.html")
注:不知什么原因,直接调用 wsl 会提示找不到文件,复制一个改名 wsl1 放在 texlive 的 bin 目录调用就正常。
from forum.
这个问题是个历史bug,在各个操作系统上(我用的是Debian Testing)随机出现。比如 @views63 的mwe所生成的html在我这里没有出现问题。
- 首先更正下lwarp的用法。不知是bug还是程序逻辑,lwarp基本上要求maketitle,不然程序会出现一些问题。可以参考我所提供的附件。我用latexmk编译,并将lwarp生成的html文件设定为了index.html。
mymwe.zip - 据经验观察本bug是因上标导致上下行串行所致。除footnote外,也包括 biblatex gb7714-2015的cite、pagescite上标。
@views63 和 @muzimuzhi 的判断应该是正确的,问题出在main_html.pdf -> main_html.html,使用 pdftotext
例如我mwe的bug中,xx_html.pdf中,显示效果正常,内容如下:
<p>根据《富士康工资、工时与生产管理调研》<sup>[1]</sup> 一文,虽然至2015 年为止,富士康工人超时加班现象仍较严重,但大量裁员现象却与之并存。
index.html中显示效果错行,内容如下:
[1] 一文,虽然至 2015 年为止,富士康工人超时加班现象仍较严重,但大量裁员现象却与之并存。 根据《富士康工资、工时与生产管理调研》
我只会应用,不懂代码开发,帮不上多少忙……
from forum.
这个问题应该可以关了,问题在 pdftotext。
from forum.
我又试验了下,
将
os.execute("pdftotext -enc " .. pdftotextenc .. " -nopgbrk -layout "
.. sourcename .. "_html.pdf " .. sourcename .. "_html.html")
去掉-layout选项,改为
os.execute("pdftotext -enc " .. pdftotextenc .. " -nopgbrk "
.. sourcename .. "_html.pdf " .. sourcename .. "_html.html")
可以解决一些错行bug,尚未发现去掉layout选项是否引发其它BUG……
from forum.
Related Issues (20)
- xeCJKsetup 报括号不匹配的问题 HOT 2
- 讨论范围:CTeX套装问题or中文TeX问题? HOT 6
- Error: Undefined control sequence HOT 17
- 汉字直排行间标点下冒号(及分号)的问题 HOT 4
- xeCJK宏包文档中3.2.1节需要增补 HOT 4
- xeCJKfntef 和 ulem 联用时影响 \textbf 的作用范围 HOT 3
- 使用XeLatex构建中文文档源码时报错: xdvipdfmx:fatal: Unknown coverage format HOT 7
- 如何在article中调整所有caption为楷体 HOT 1
- linux和windows下伪粗效果不统一 HOT 6
- 中英文之间空格不习惯,如何去掉? HOT 11
- CJKfntef 是否具有 xeCJKfntef 的 subtract 功能?
- CTeX 3.0.212.1 xelatex编译通过,但无法生成pdf。dvipdfmx:fatal: typecheck: Invalid object type: -1 7 (line 2378)] HOT 6
- 关于LaTeX2e中文档类使用l3keys键对值的问题 HOT 8
- 当minipage环境和enumerate配合使用时,引入hyperref宏包会导致minipage顶部对齐失效 HOT 2
- 选项 leqno 与 fleqn 的缩写 HOT 13
- 我想将某些内容固定排版在偶数页的页面底部,但使用\ifodd\value{page}进行判断时在某些情形下会失效 HOT 4
- `jiazhu` 宏包是否能实现 `linespread < 1` 的排版效果?
- 如何将附录放在backmatter后同时对附录进行编号? HOT 6
- 能否实现英语句子中自动使用非中文字体的标点符号 HOT 3
- How to draw an specific feynman diagram with TikZ (LaTeX) HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from forum.