ElegantLaTeX/ElegantBook

建议给 `\cover` 和 `\logo` 设置缺省值

sikouhjw opened this issue · 1 comments

LaTeX技术交流 2 群:478023327 遇到一个人提问,报错为缺少图片,他没有意识到 \maketitle 与图片之间的关系
#62 完成之前,可以给 \cover\logo 设置缺省值,例如 MWE 宏包中的图片,示意图如下:
1
示意图实现如下:

\documentclass[lang=cn,11pt]{elegantbook}
\usepackage{mwe}
\title{Title}
\subtitle{Subtitle is here}
\author{Your Name}
\institute{XXX University}
\date{\today}
\version{1.00}
\extrainfo{Victory won\rq t come to us unless we go to it. --- M. Moore}
\logo{example-image-plain.pdf}
\cover{example-image-plain.pdf}

\begin{document}
\maketitle
\end{document}

具体实现如下:将

\logo{logo-blue.png}
\cover{cover.jpg}

删除,在 cls 中设置缺省值,这样就不会出现原因为“缺少图片”的报错,然后在说明手册中写明如果要更换封面需要加上这两个命令、在对应文件夹里加上对应的图片。
优点:

  • 更加需要用户阅读手册,节省了使用成本、沟通成本

缺点:

  • MWE 宏包的图片没有原来封面的图片优雅

可能的扩展:

  • 将所有封面的命令都设置缺省值,那么最小示例
    \documentclass[lang=cn,11pt]{elegantbook}
    % title info
    \title{Title}
    \subtitle{Subtitle is here}
    % bio info
    \author{Your Name}
    \institute{XXX University}
    \date{\today}
    % extra info
    \version{1.00}
    \extrainfo{Victory won\rq t come to us unless we go to it. --- M. Moore}
    \logo{logo.png}
    \cover{cover.jpg}
    \begin{document}
    \maketitle
    \frontmatter
    \tableofcontents
    \mainmatter
    % add preface chapter here if needed
    \chapter{Example Chapter Title}
    The content of chapter one.
    \bibliography{reference}
    \end{document}
    就不需要加参数也能正常编译了

已经更新。