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

[Bug]: 硕博模板书脊不适应长标题 #505

Closed
YDX-2147483647 opened this issue May 16, 2024 · 7 comments · Fixed by #511
Closed

[Bug]: 硕博模板书脊不适应长标题 #505

YDX-2147483647 opened this issue May 16, 2024 · 7 comments · Fixed by #511
Assignees
Labels
🐛 bug Something isn't working

Comments

@YDX-2147483647
Copy link
Collaborator

YDX-2147483647 commented May 16, 2024

发生了什么?

标题很长时,书脊的标题、姓名、学校会粘在一起。即使下面有空,也不往下挪。

IRYFQKT9E{}6E6_$W30 _33

你期望的结果

VXP$AU{{OJE9V`NJ3}7@ )I

问题复现的步骤(或者截图)

足够长的标题:八月秋高风怒号卷我屋上三重茅茅飞渡江洒江郊高者挂罥长林梢下者飘转沉塘坳

相关代码

这俩\vfill有时无效,原因不明。

BIThesis/bithesis.dtx

Lines 1929 to 1931 in 2f6cf63

\vfill
{\heiti\zihao{3}\@@_secret_info:nn{\l_@@_value_author_tl}{\g_@@_const_substitute_symbol_tl\quad\g_@@_const_substitute_symbol_tl\quad\g_@@_const_substitute_symbol_tl}}
\vfill

@YDX-2147483647
Copy link
Collaborator Author

YDX-2147483647 commented May 16, 2024

临时解决方案

编辑bithesis.cls,搜索“书脊”,把上面提到的两处\vfill换成\vspace{1em}

@YDX-2147483647 YDX-2147483647 added the 🐛 bug Something isn't working label May 16, 2024
@YDX-2147483647
Copy link
Collaborator Author

YDX-2147483647 commented May 21, 2024

给书脊的minipage环境套\fbox{…},发现框太小了。

图片
图片

https://github.com/tuna/thuthesis/blob/1ce3b32ff8b37a1ae1d12a0a58f82e6067281774/thuthesis.dtx#L6918-L6937

  \begingroup
    \noindent\hfill
    \rotatebox[origin=lt]{-90}{%
      \makebox[\textheight]{%
        \fangsong
        \addCJKfontfeatures*{RawFeature={vertical}}%
        \thu@spine@font
        \CJKmove
        #1\hfill
        \thu@stretch{4.5em}{#2}%
      }%
    }%
  \endgroup

\thu@stretch的功能:如果内容小于给定宽度,则拉伸至该宽度,否则取自然宽度。

https://github.com/tuna/thuthesis/blob/1ce3b32ff8b37a1ae1d12a0a58f82e6067281774/thuthesis.dtx#L4378-L4381

cjk - Vertical Chinese text with XeTeX - TeX - LaTeX Stack Exchange

@fky2015
Copy link
Contributor

fky2015 commented May 21, 2024

距下边界均为 5cm 左右。

当时编写时参考的要求。

@YDX-2147483647
Copy link
Collaborator Author

YDX-2147483647 commented May 21, 2024

那上边距有要求吗?

Word模板 v.s. LaTeX模板

图片

@fky2015
Copy link
Contributor

fky2015 commented May 22, 2024

那上边距有要求吗?

Word模板 v.s. LaTeX模板

图片

有要求,都是 5cm 左右

@YDX-2147483647
Copy link
Collaborator Author

YDX-2147483647 commented May 22, 2024

% 对齐中西基线
% https://tex.stackexchange.com/a/38585
\newcommand*\CJKmovesymbol[1]{\raise.35em\hbox{#1}}
\newcommand*\CJKmove{\punctstyle{plain}% do not modify the spacing between punctuations
  \let\CJKsymbol\CJKmovesymbol
  \let\CJKpunctsymbol\CJKsymbol}
% \begin{macro}{\make_paper_back:}
% 制作书脊。
%    \begin{macrocode}
\cs_new:Npn \make_paper_back: {
  \cleardoublepage
  \currentpdfbookmark{书脊}{frontmatter:paperback}
  \begin{titlepage}
    % 上下各留出规定的边距,到下一页再恢复
    \newgeometry{
      vmargin = 5cm,
    }
    \centering
    % 把盒子竖过来,盒子内相当于一行;再把汉字利用字体特性转回来。
    % 存在的问题:破折号断开
    \rotatebox[origin=lt]{-90}{
      % 实际使用时:\framebox → \makebox
      \framebox[\textheight]{
        \heiti\zihao{3}
        \addCJKfontfeatures*{RawFeature={vertical}}
        \CJKmove
        %
        % 标准例子:
        形状记忆聚氨酯的合成及其在织物中的应用
        %
        % 西文例子:
        % 形状记忆聚氨酯 \hspace{0.2em}
        % \rotatebox{90}{L} \hspace{0.2em}
        % \rotatebox{90}{T} \hspace{0.2em}
        % \rotatebox{90}{X} \hspace{0.2em}
        % 的合成Feng Kaiyu及其在织物中的应用
        %
        % 超长例子:
        % 八月秋高风怒号卷我屋上三重茅茅飞渡江洒江郊高者挂罥长林梢下者飘转沉塘坳
        \hspace{1em plus 1fill}
        杜甫
        \hspace{1em plus 1fill}
        北京理工大学
      }
    }
    \restoregeometry
  \end{titlepage}
}

图片
图片
图片

@YDX-2147483647
Copy link
Collaborator Author

测量像素结果

  • Word模板:上 57 mm,下 46 mm。(两个Word模板一样)
  • LaTeX v3.7.7 模板:上 37 mm,下 60 mm。

@YDX-2147483647 YDX-2147483647 self-assigned this May 22, 2024
YDX-2147483647 added a commit to YDX-2147483647/BIThesis that referenced this issue May 22, 2024
Resolves BITNP#505

具体修改如下。

- `\vskip` → `\newgeometry` + `\restoregeometry`

  原来的`\vskip`没生效(删掉后编译结果相同),而且需要从上边距开始算。干脆改边距好了。

- `center`环境 → `\centering`

  lshort-zh-cn:`center`等环境会在上下文产生一个额外间距,而`\centering`等命令不产生,只是改变对齐方式。

- `minipage`环境的对齐方式 `t` → `c`

  这样遇到超长标题时,可以向两边溢出。

- `\vfill` → `\par` + `\vpace`

  `\vspace`可以设置间距最小值,避免标题稍长就和姓名学校粘在一起。

  另外,`\vfill`会直接生效,而`\vspace`不会,所以要加`\par`。
YDX-2147483647 added a commit to YDX-2147483647/BIThesis that referenced this issue May 22, 2024
Resolves BITNP#505

具体修改如下。

- `\vskip` → `\newgeometry` + `\restoregeometry`

  原来的`\vskip`没生效(删掉后编译结果相同),而且需要从上边距开始算。干脆改边距好了。

- `center`环境 → `\centering`

  lshort-zh-cn:`center`等环境会在上下文产生一个额外间距,而`\centering`等命令不产生,只是改变对齐方式。

- `minipage`环境的对齐方式 `t` → `c`

  这样遇到超长标题时,可以向两边溢出。

- `\vfill` → `\par` + `\vpace`

  `\vspace`可以设置间距最小值,避免标题稍长就和姓名学校粘在一起。

  另外,`\vfill`会直接生效,而`\vspace`不会,所以要加`\par`。
github-merge-queue bot pushed a commit that referenced this issue May 24, 2024
Resolves #505

具体修改如下。

- `\vskip` → `\newgeometry` + `\restoregeometry`

  原来的`\vskip`没生效(删掉后编译结果相同),而且需要从上边距开始算。干脆改边距好了。

- `center`环境 → `\centering`

  lshort-zh-cn:`center`等环境会在上下文产生一个额外间距,而`\centering`等命令不产生,只是改变对齐方式。

- `minipage`环境的对齐方式 `t` → `c`

  这样遇到超长标题时,可以向两边溢出。

- `\vfill` → `\par` + `\vpace`

  `\vspace`可以设置间距最小值,避免标题稍长就和姓名学校粘在一起。

  另外,`\vfill`会直接生效,而`\vspace`不会,所以要加`\par`。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
2 participants