Skip to content

优化封面个人信息中的自动换行效果 #1

Description

@xkwxdyy

问题描述

example/cover-example3.tex 中使用了 {{}, 赵六}, 来排版出换行的效果:

addinfo = {
{学院, 测绘学院},
{专业, 导航工程},
{班级, 2020 级 x 班},
{组员, 张三、李四、王五},
{{}, 赵六},
{学号, 202020212022}
}

但作为模版来说,我并不建议这样处理。

模版具有传播性,可能这里传来传去,模版的手册可能会丢失,即使有模版手册,不能保证每个用户都能完整地看一遍手册(这是 LaTeX 模版的普遍现状),所以这个换行方法不能确保每个用户都知道。

还有一点,其实这个从某种角度也违背了”内容和样式分离”的思想,因为作为一个好的模版来讲,用户要做的是输入内容,仅此而已。

优化想法

第一个想法是用 \parbox ,但是这个就需要固定宽度,可能不太好。

可以尝试用 varwidth 环境来获得“弹性最大宽度“

\documentclass{ctexart}
\usepackage{varwidth}
\usepackage{xeCJKfntef}

\begin{document}

组员:
\begin{varwidth}[t]{0.5\textwidth}
  \CJKunderline*{张三、李四、王五、赵六}
\end{varwidth}

组员:
\begin{varwidth}[t]{0.5\textwidth}
  \centering
  \CJKunderline*{张三、李四、王五 \\ 赵六}
\end{varwidth}

\end{document}

image

如果换行后还要是整行的下划线,可以参考我的那个 CCNUthesis

https://github.com/xkwxdyy/CCNUthesis/blob/f296da08073b2c4dd1a68da3fe34c64b21fa05e8/CCNUthesis.cls#L2431-L2544

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions