系统/Lyx 升级后 PDF 输出大小发生变化(pdflatex)

系统/Lyx 升级后 PDF 输出大小发生变化(pdflatex)

在过去的几个月里,我将我的系统 (Debian) 从 Jessie 升级到了 Stretch。我怀疑 LaTeX 和其他软件包也更新了。我使用 Lyx。

我的小说是用 Lyx 2.1 格式化的,现在我使用的是 Lyx 2.2.2。自从我重新打开原始 Lyx 文件后,PDF 输出已从 140 x 266mm 更改为 216 x 276mm(美国信纸),而我并没有编辑任何设置。我使用 pdflatex 输出文件,因此没有更改它。但是 latex 日志现在显示此错误:

Package geometry Warning: The marginal notes overrun the paper.
     Add 98.865pt and more to the right margin.

如果我使用 ps2pdf 从 Lyx 输出,输出结果将正确。显然,我不想将输出切换为 ps2pdf,因为 pdflatex 以前工作正常,而我担心为什么输出现在不能正常工作。

我正在使用回忆录模块来格式化我的小说,正如我在其他问题中发现的那样,这现在可能与几何(Lyx 自动设置)冲突。

这是一个已知问题/错误吗?如果我需要提供更多信息来了解发生了什么,我需要提供什么?

这是一个无效(错误)文件的 pastebin:https://pastebin.com/ZepvZ9aV 并将一个基本的 svg 嵌入到所用文件的位置:https://pastebin.com/u0Zq0hPG

我已确定文件中引用的 SVG 和 PNG 是原因。如果删除它们,文件将以正确的大小呈现。我需要文件中的图像,所以只需找出某个地方是否存在错误,或者是否是我系统上的软件包组合的问题。

Inkscape 0.92.1 r15371

Lyx 中的构建信息:

LyX 2.2.2 (2016-10-10)
  Git commit hash 
Configuration
  Host type:               x86_64-pc-linux-gnu
  Special build flags:      build=release warnings c++11 std-regex use-enchant
  C++ Compiler:            g++ (6.2.1)
  C++ Compiler flags:       -Wall -Wextra -std=c++11 -fPIC -O2 -Wno-deprecated-declarations
  C++ Compiler user flags: -Wdate-time -D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/lyx-2.2.2=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC
  Linker flags:            
  Linker user flags:       -Wl,-z,defs -Wl,--as-needed -Wl,-z,relro -Wl,-z,now
  Qt Frontend:
      Qt version:      5.7.1
  Packaging:               posix
  LyX binary dir:          /usr/bin
  LyX files dir:           /usr/share/lyx

pdflatex:这是 pdfTeX,版本 3.14159265-2.6-1.40.17(TeX Live 2016/Debian)(预加载格式=pdflatex)

原始(工作)文件和新保存的错误文件之间的差异如下:

--- /original.lyx
+++ /modified.lyx
@@ -1,7 +1,9 @@
-#LyX 2.1 created this file. For more info see
-\lyxformat 474
+#LyX 2.2 created this file. For more info see 
+\lyxformat 508
 \begin_document
 \begin_header
+\save_transient_properties true
+\origin unavailable
 \textclass memoir
 \begin_preamble
 \usepackage{microtype} % reduce amount of unnecessary and broken hyphenation
@@ -47,18 +49,18 @@
 \language_package default
 \inputencoding auto
 \fontencoding global
-\font_roman charter
-\font_sans default
-\font_typewriter default
-\font_math auto
+\font_roman "charter" "default"
+\font_sans "default" "default"
+\font_typewriter "default" "default"
+\font_math "auto" "auto"
 \font_default_family rmdefault
 \use_non_tex_fonts false
 \font_sc false
 \font_osf false
-\font_sf_scale 100
-\font_tt_scale 100
+\font_sf_scale 100 100
+\font_tt_scale 100 100
 \graphics default
-\default_output_format default
+\default_output_format pdf
 \output_sync 0
 \bibtex_command default
 \index_command default
@@ -331,7 +333,8 @@
 \begin_inset Newline newline
 \end_inset

-Typeset in Bitstream Charter 10pt using LaTeX
+Typeset in Bitstream Charter 10pt using \SpecialChar LaTeX
+
 \end_layout

 \begin_layout Standard
@@ -376,6 +379,10 @@

 \end_layout

+\end_inset
+
+
+\begin_inset Separator latexpar
 \end_inset


@@ -1615,6 +1622,10 @@
 \end_inset


+\begin_inset Separator latexpar
+\end_inset
+
+
 \end_layout

 \begin_layout Standard

编辑(已解决)我从未解决过 Lyx 的问题,但这似乎是由于新版本的 geometry 和 memoir 不太宽容造成的。虽然旧版本可以正确生成文件(但有错误),但新版本会调整页面大小以适应。我最终放弃了使用 Lyx 来编辑我的小说,而是手动编写文件并重新计算页面尺寸,然后仅使用 memoir 的边距/大小设置来确定布局并从文件中删除 geometry 包。

答案1

解决方案:告诉 LyX 使用 inkscape 来转换 SVG 文件而不是 rsvg-convert:

  1. 转到工具 > 首选项 > 转换器。

  2. 选择“SVG -> EPS”,并将“转换器”更改为:

    inkscape --file=$$i --export-area-drawing --without-gui --export-eps=$$o

  3. 点击“修改”。

  4. 点击“保存”。

现在对“SVG -> PDF”执行相同的操作:

  1. 转到工具 > 首选项 > 转换器。

  2. 选择“SVG -> PDF”,然后将“转换器”更改为:

    inkscape --file=$$i --export-area-drawing --without-gui --export-pdf=$$o

  3. 点击“修改”。

  4. 点击“保存”。

PDF(pdflatex)的输出现在应该与以前的相同。

rsvg-convert 似乎比 inkscape 更受欢迎(即,如果两者都可用,则使用 rsvg-convert)因为它更快。 也可以看看这张票了解更多信息。

答案2

(实际上不是答案,更像是一条长评论)

根本区别在于 latex 和 pdflatex 的图形后端不同。LyX 知道在使用 pdflatex 编译时将 .svg 文件转换为 .pdf,在使用 latex 编译时将其转换为 .eps。这是一个“非 LyX MWE”(在 LyX 在后台进行图像转换后创建),显示了差异:压缩包。可以使用以下命令创建不同的 PDF:

latex mwe.tex && dvips mwe.dvi && ps2pdf mwe.ps && mv mwe.pdf mwe_latex.pdf
pdflatex mwe.tex && mv mwe.pdf mwe_pdflatex.pdf

您可以考虑使用这个非 LyX MWE 发布一个新问题,以便这里的专家可以看看。

LyX 仍可能是导致该问题的原因。例如,LyX 使用命令将 .svg 转换为 .pdf 和 .eps。如果 LyX 使用了错误的命令,则可能解释了该问题。但是,我已使用 LyX 2.1.0 版进行了测试,并且仍然可以重现差异。因此,如果您看到行为发生变化,我猜这是由于更新的 TeX 系统或 LyX 用于转换的外部工具(在本例中为 inkscape)造成的。

请注意,使用 rsvg-convert(而不是 inkscape)将 .svg 文件转换为 .pdf 和 .eps 会导致同样的问题。这让我认为 inkscape 的更改(例如当您升级系统时)不太可能解释该问题。

相关内容