Git Product home page Git Product logo

elegantbook's Introduction

elegantbook's People

Contributors

azzamsa avatar ethandeng avatar sikouhjw avatar syvshc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

elegantbook's Issues

调整章节标题悬挂缩进的实现

根据 #49 (comment)#49 (comment) ,目前章节标题悬挂缩进的距离是固定的 2.45em

ElegantBook/elegantbook.cls

Lines 366 to 373 in ae0d420

\titleformat{\section}[hang]{\bfseries}
{\hspace{-2.45em}\Large\bfseries{\color{structurecolor}\thesection}\enspace}{1pt}{\color{structurecolor}\Large\bfseries\filright}
\titleformat{\subsection}[hang]{\bfseries}
{\hspace{-2.45em}\large\bfseries\color{structurecolor}\thesubsection\enspace}{1pt}{\color{structurecolor}\large\bfseries\filright}
\titleformat{\subsubsection}[hang]{\bfseries}
{\hspace{-2.45em}\large\bfseries\color{structurecolor}\thesubsubsection\enspace}{1pt}{\color{structurecolor}\large\bfseries\filright}

在 section label 的宽度较大时,输出样式会不一致(见下图 “Before” 部分),建议修改。

假设仍燃使用悬挂风格,有多种方案,

  1. 使用固定距离的悬挂缩进,缩进距离(例如为 \sectionLabelWidth)可设置。
  2. 使用固定距离的悬挂缩进,缩进距离自动计算,为 max(某个固定距离, section label 的最大宽度 + 固定距离)。实现方式是比较并记录 section label 的最大宽度,记录在 aux 文件中,第二次编译时读取。
  3. 使用可变距离的悬挂缩进,将整个 section label 悬挂出去并靠右对齐。

方案比较

  • 固定比可变更常见
  • 固定的两个方案中,1 实现简单但需要手动调整,2 实现稍复杂、需要二次编译但功能自动生效

以下例子展示了当前实现和第三种方案的效果,同时也简化了 \titleformat 的使用。

\documentclass{elegantbook}
\usepackage{lipsum}
\linespread{1}\selectfont

\newcommand\test[1]{
  \refstepcounter{chapter}
  \noindent{\LARGE\bfseries #1}
  \section{title}
  \setcounter{section}{10}
  \section{title}
  \setcounter{chapter}{10}
  \section{long long long long long long long long long long long long long long long long long title}
  \lipsum[23]
  \vspace{20pt}
}

\begin{document}
%% current setting
%\titleformat{\section}[hang]
%  {\bfseries}
%  {\hspace{-2.45em}\Large\bfseries{\color{structurecolor}\thesection}\enspace}
%  {1pt}
%  {\color{structurecolor}\Large\bfseries\filright}

\test{Before}

%% suggested setting
\titleformat{\section}[hang]
  {\Large\bfseries\color{structurecolor}}
  {\llap{\thesection\enspace}}
  {0pt}
  {}

\setcounter{chapter}{1}
\test{After}
\end{document}

image

如果觉得需要该,并且能确定修改方案,我可以提供实现。

ElegantBook不能显示siunitx宏包的\angstrom命令

2019/7/29下载的最新模板
MWE如下
`\documentclass[lang=cn,11pt]{elegantbook}

\usepackage{siunitx}

\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{logo.png}

\cover{cover.jpg}

\begin{document}

\maketitle

\mainmatter

\hypersetup{pageanchor=true}

\chapter{Example Chapter Title}

\si{\angstrom}

\end{document}`
PDF正文部分一片空白,已尝试在ctexart标准文档类使用\angstrom命令,正常。

让 bm 宏包少声明一些数学字体

bm 宏包会额外声明 4 个数学字体,这容易让「最多 16 个数学字体」的限额变得紧张。

根据文档 texdoc bm, sec. 2,通过使用

\newcommand\bmmax{0}
\RequirePackage{bm}

可以让 bm 宏包不额外声明数学字体,代价是

  • 稍慢的运行速度
  • 无法加粗定界符

采用xeLatex编译器

在Overleaf中编辑,默认编译器是 pdfLatex 报了一对错。希望可以在README说明 使用 xeLatex编译器

定义环境没有标题和标签时结果有问题

最小例子

\documentclass[cn,11pt,cyan]{elegantbook}
\begin{document}
\begin{definition}
测试
\end{definition}
\end{document}

结果
20190625022156
期待结果
20190625022349
目前只能使用如下代码实现

\documentclass[cn,11pt,cyan]{elegantbook}
\begin{document}
\begin{definition}{ }{}
测试
\end{definition}
\end{document}

修改 elegantbook.cls 中的 \newenvironment{definition}[2]

\newenvironment{definition}[2]
  {\ifstrempty{#1}{}{\edefinition[#1]}\ifstrempty{#2}{}{\label{def:#2}}}
  {\endedefinition}

仍需要使用 \begin{definition}{}{} 才能达到效果。期望能直接使用 \begin{definition} 达到期望的效果。

Page margin problem

I have a few problems about margin.

  1. The section title exceeds the content border, as indicated by the arrows in the figure below.
    image

  2. In twoside mode, the left and right margins for odd and even page are inverse. As shown below, the right margin is wider for odd page, and the left margin is wider for even page, which should be opposite.
    image
    image

  3. If I manually set page margin, the header text doesn't align with header line, and the margin size is not what I specified. For example
    \geometry{top=1cm,bottom=1cm,inner=2.5cm,outer=1.5cm,includeall}
    it shows
    image
    image

You can click the pictures to clearly identify the margin. I use MikTex on windows 10. The elegantbook version is 3.08.

定理类环境定义修改意见征询

现有定理用法

今天在用户群,讨论到定理的问题,现有的定理形式是:

\begin{theorem}{theorem name}{label}
The content of theorem.
\end{theorem}

其中用到的是 tcolorbox 宏包的 newtcbtheorem 命令,对于这个定理的引用,使用 \ref{thm:label}。而为了兼容 mode=simplemode=fancy,在 simple 模式下,实际调用的为 amsthm,即通过 newtheorem 命令定义。

在 ElegantBook 中,如果定理名没有或者不需要引用时,需要写成

\begin{theorem}{}{}
The content of theorem.
\end{theorem}

amsthm 定理用法

一般通过 amsthm 定义的定理使用方法是

\begin{theorem}[theorem name]\label{thm:label}
The content of theorem.
\end{theorem}

这种可选项作为定理名的方式有一个好处是,如果定理没有名字,也不需要引用,可以写成

\begin{theorem}
The content of theorem.
\end{theorem}

也就是在偷懒或者信息缺失的时候,这样写看着更加自然。

讨论

其实这个问题我原来也考虑过,不是考虑写起来麻烦还是不麻烦,而是兼容性问题,也就是把 ElegantBook 中的定理搬到其他模板/文类中不可以直接使用,需要修改之后才可以。我有计划改动,但由于这个定理的设置会影响到大部分人,而且是大幅度的,因此希望大家能够积极表达自己的观点。

改动方向:

放弃 newtcbtheorem 默认定理命令,改用一般环境定义命令 tcolorboxenvironment,结合 amsthm 定义定理类环境。

:关于 amsthmntheorem 的讨论,请参考:Theorem packages: which to use, which conflict?

完善封面

未来方向:

  1. 弹性输出封面作者信息,避免缺少信息导致报错;
  2. 封面改为自选,也即允许用户使用定制封面 PDF。

建议:单双页使用不同页边距

考虑到书籍在装订时方便,对于单双页来讲,左侧和右侧的页边距一般是不同的。简单来讲,单页装订侧在左,双页装订侧在右,因此单页左侧页边距=双页右侧页边距>单页右侧页边距=双页左侧页边距。为了方便装订,希望作者能将此问题列入考虑,单双页设置不同的页边距。

将例题作为练习的上级计数器

ElegantBook/elegantbook.cls

Lines 545 to 555 in 5fece14

%% Exercise with counter
\newcounter{prob}[chapter]
\setcounter{prob}{0}
\renewcommand{\theprob}{\thechapter.\arabic{prob}}
\newenvironment{problem}[1][]{
\refstepcounter{prob}\par\noindent\textbf{\color{main}{%
\ifdefstring{\ELEGANT@lang}{en}{Problem}{例题}
}\theprob #1 \,}\rmfamily %
}{
\par\medskip\ignorespacesafterend %
}

移到

ElegantBook/elegantbook.cls

Lines 533 to 543 in 5fece14

%% Exercise with counter
\newcounter{exer}[chapter]
\setcounter{exer}{0}
\renewcommand{\theexer}{\thechapter.\arabic{exer}}
\newenvironment{exercise}[1][]{
\refstepcounter{exer}\par\noindent\makebox[-3pt][r]{\scriptsize\color{red!90}\HandPencilLeft\quad}\textbf{\color{main}{%
\ifdefstring{\ELEGANT@lang}{en}{Exercise}{练习}
}\theexer #1 \,}\rmfamily %
}{
\par\medskip\ignorespacesafterend %
}

之前,将

ElegantBook/elegantbook.cls

Lines 534 to 536 in 5fece14

\newcounter{exer}[chapter]
\setcounter{exer}{0}
\renewcommand{\theexer}{\thechapter.\arabic{exer}}

改为

\newcounter{exer}[prob]
\setcounter{exer}{0}
\renewcommand{\theexer}{\theprob.\arabic{exer}}

url包含下划线字符时报错

url中的下划线会被当作下标处理,尽管链接指向仍然正确。

MWE(已删除)
https://www.overleaf.com/read/hpmhfxvcmjys

代码片段
\url{https://www.youtube.com/channel/UCllYBm-_FbqWuI92o6zPXfw}

已经确定这不是hyperref的问题,在其他模板中使用hyperref并复制elegantbook中的参数不会报错也不会异常显示下标

修改\section换页后出现页眉错误

\documentclass[cn,11pt,twoside]{elegantbook}
\usepackage{zhlipsum}
\titleclass{\section}{top}
\newcommand\sectionbreak{\clearpage}
\begin{document}
\chapter{Elegant\LaTeX{} 系列模板介绍}
\section{第一章}
\zhlipsum[1-10]
\section{第二章}
\zhlipsum[1]
\end{document}

具体表现为第五页的页眉显示为第二章而不是第一章

Mac编译运行报错

kpathsea: Running mktextfm SimSun/OT

/usr/local/texlive/2017/texmf-dist/web2c/mktexnam: Could not map source abbreviation O for OT. /usr/local/texlive/2017/texmf-dist/web2c/mktexnam: Need to update /usr/local/texlive/2017/texmf-dist/fonts/map/fontname/special.map?

mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input OT

This is METAFONT, Version 2.7182818 (TeX Live 2017) (preloaded base=mf)

kpathsea: Running mktexmf OT

! I can't find file `OT'. <> \mode:=ljfour; mag:=1; nonstopmode; input OT Please type another input file name ! Emergency stop. <> \mode:=ljfour; mag:=1; nonstopmode; input OT Transcript written on mfput.log.

grep: OT.log: No such file or directory

mktextfm: `mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input OT' failed to make OT.tfm. kpathsea: Appending font creation commands to missfont.log. kpathsea: Running mktextfm SimSun/OT

/usr/local/texlive/2017/texmf-dist/web2c/mktexnam: Could not map source abbreviation O for OT. /usr/local/texlive/2017/texmf-dist/web2c/mktexnam: Need to update /usr/local/texlive/2017/texmf-dist/fonts/map/fontname/special.map?

mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input OT

This is METAFONT, Version 2.7182818 (TeX Live 2017) (preloaded base=mf)

kpathsea: Running mktexmf OT

! I can't find file `OT'. <> \mode:=ljfour; mag:=1; nonstopmode; input OT Please type another input file name ! Emergency stop. <> \mode:=ljfour; mag:=1; nonstopmode; input OT Transcript written on mfput.log.

grep: OT.log: No such file or directory

mktextfm: `mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input OT' failed to make OT.tfm.

kpathsea: Running mktextfm KaiTi/OT

/usr/local/texlive/2017/texmf-dist/web2c/mktexnam: Could not map source abbreviation O for OT. /usr/local/texlive/2017/texmf-dist/web2c/mktexnam: Need to update /usr/local/texlive/2017/texmf-dist/fonts/map/fontname/special.map?

mktextfm: Running mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input OT

This is METAFONT, Version 2.7182818 (TeX Live 2017) (preloaded base=mf)

kpathsea: Running mktexmf OT

! I can't find file `OT'. <> \mode:=ljfour; mag:=1; nonstopmode; input OT Please type another input file name ! Emergency stop. <> \mode:=ljfour; mag:=1; nonstopmode; input OT Transcript written on mfput.log.

grep: OT.log: No such file or directory

mktextfm: `mf-nowin -progname=mf \mode:=ljfour; mag:=1; nonstopmode; input OT' failed to make OT.tfm. kpathsea: Running mktextfm KaiTi/B/OT

/usr/local/texlive/2017/texmf-dist/web2c/mktexnam: Could not map source abbreviation O for OT. /usr/local/texlive/2017/texmf-dist/web2c/mktexnam: Need to update /usr/local/texlive/2017/texmf-dist/fonts/map/fontname/special.map?

Error: Command crashed: xelatex -synctex=1 -interaction=nonstopmode "elegantbook-en".tex

Process exited with error(s)

version 3.09 corrupts templates / mess up with font maps?

When I compile my book project, I get the following error (several times): "Font U/esint/m/n/10=esint10 at 10.0pt not loadable: Metric (TFM) file not found. \maketitle". I saw in the class file that a package named mtpro2 is requested, which does not exist on CTAN. I don't know this has to do with the issue....
Anyway, I don't know from where the error comes. Everything worked fine until Version 3.08.
I'm using up to date MiKTeX 2.9 under Windows 10.

bib

\nocite{EINAV2010,Havrylchyk2018} 是不给出引用的意思吗?为什么还是给出来了?而有的没显示引用?

作者名不能加* 吗?

建议改预设的字体为推荐的,让用户自己选择字体

首先预设的数学字体确实符合网上流传的漂亮字体的建议。然而字体对于LaTeX 用户来说通常会造成麻烦。比如 mtpro2 和 esint。前者是付费字体,大多数用户没有,即使是mtpro2 lite的版本,可能很多用户也不熟悉。esint 由于宏包升级删去了 esint10.tfm,给使用最新版宏包的用户造成了很多麻烦。尤其是没有完全安装TeXLive 或者 MikTeX的用户。要想运行成功新的elegentbook 模板,要花很多功夫补这些字体。

所以从用户的角度,最好是给出一些推荐字体,说明这些字体的来源。让用户自己选择字体组合。
网上推荐的一些免费的字体组合,如 \usepackage{charter}\usepackage[charter]{mathdesign} , 以及 \usepackage{libertine}\usepackage[libertine]{newtxmath} 都是不错的组合。并且这些字体都是免费的,且已经包含在 TeX 系统里面。

比率符号的使用

有用户希望插入比率符号,如图所示:

image

所谓「比号」是 U+2236 Ratio ,注意与冒号 U+003A Colon : 和全角冒号 U+FF1A Fullwidth colon 区分。

ElegantBook 模板所使用的西文字体并不包含这一符号,而中文字体一般是包含的。但 xeCJK 宏包默认把这一符号使用西文字体输出,因此需要做一些修改:

% 导言区
\xeCJKDeclareCharClass{FullRight}{"2236}
\newcommand\ratio[2]{#1^^^^2236#2}

第一行把 U+2236 这一符号设为 FullRight 字符类,使用中文字体输出,禁则处理类似冒号(右标点);第二行定义一个命令用来方便输出,其中的 ^^^^2236 相当于直接在代码中输入

使用时可采用 \ratio{1}{5000} 的语法。效果如下:

image

为色彩使用增加一层抽象

if (lang == "xx")
  \deinecolor{<base color>}{<color model>}{<spec list>}
fi
\colorlet{<color in use>}{<base color>}
\fancyhead{\color{<color in use>}...}

<base color>   ::= "main" | "second" | ...
<color in use> ::= "header and footer" | "section title" | ...

详见 #12 (comment)

开 issue 以记录工作任务。

在Ubuntu1804中编译出错

This is XeTeX, Version 3.14159265-2.6-0.99998 (TeX Live 2017/Debian) (preloaded format=xelatex)
restricted \write18 enabled.
entering extended mode
(/home/shao/Documents/MyOneDrive/OneDrive - hrbeu.edu.cn/projects/doc_latex/ElegantBook-master/elegantbook-cn.tex
LaTeX2e <2017-04-15>
Babel <3.18> and hyphenation patterns for 3 language(s) loaded.
(./elegantbook.cls
Document Class: elegantbook 2019/02/24 v3.06 ElegantBook document class
(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty (/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty) (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty (/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty)))) (/usr/share/texlive/texmf-dist/tex/latex/etoolbox/etoolbox.sty) (/usr/share/texlive/texmf-dist/tex/latex/base/book.cls
Document Class: book 2014/09/29 v1.4h Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/bk12.clo)) (/usr/share/texlive/texmf-dist/tex/latex/tools/indentfirst.sty) (/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty) (/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty) (/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.sty (/usr/share/texlive/texmf-dist/tex/latex/l3packages/xparse/xparse.sty (/usr/share/texlive/texmf-dist/tex/latex/l3kernel/expl3.sty (/usr/share/texlive/texmf-dist/tex/latex/l3kernel/expl3-code.tex) (/usr/share/texlive/texmf-dist/tex/latex/l3kernel/l3xdvipdfmx.def))) (/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec-xetex.sty (/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty (/usr/share/texlive/texmf-dist/tex/latex/base/tuenc.def)) (/usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.cfg))) (/usr/share/texlive/texmf-dist/tex/xelatex/xecjk/xeCJK.sty (/usr/share/texlive/texmf-dist/tex/latex/l3packages/xtemplate/xtemplate.sty) (/usr/share/texlive/texmf-dist/tex/latex/l3packages/l3keys2e/l3keys2e.sty) (/usr/share/texlive/texmf-dist/tex/xelatex/xecjk/xunicode-addon.sty (/usr/share/texlive/texmf-dist/tex/xelatex/xunicode/xunicode.sty (/usr/share/texmf/tex/latex/tipa/t3enc.def) (/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty (/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty (/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty) (/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/graphics.cfg) (/usr/share/texlive/texmf-dist/tex/latex/graphics-def/xetex.def))))) (/usr/share/texlive/texmf-dist/tex/xelatex/xunicode/xunicode.sty
*** Reloading Xunicode for encoding 'TU' ***
) (/usr/share/texlive/texmf-dist/tex/xelatex/xecjk/xunicode-extra.def) (/usr/share/texlive/texmf-dist/tex/xelatex/xecjk/xeCJK.cfg))

! LaTeX Error: File `newtxmath.sty' not found.

Type X to quit or to proceed,
or enter new name. (Default extension: sty)

Enter file name:
./elegantbook.cls:66: Emergency stop.
<read *>

l.66 ^^I\setCJKfamilyfont
{zhsong}{SimSun}^^M
No pages of output.
Transcript written on elegantbook-cn.log.

查看了Tex Live的目录,里面有newtxmath.sty文件,请问如何修改?
另:注释掉\RequirePackage{newtxmath}后编译还是出错,提示“! LaTeX Error: File firamono.sty' not found.” 再注释掉,会提示“! LaTeX Error: File texnames.sty' not found.”
再注释掉就可以编译了。

\displaystyle \int 没有任何效果

\displaystyle \int 可以使上下标分别在上下位置。但在这个模板中起不到这个效果,请问怎样才能达到这个效果?

颜色主题讨论与征集

欢迎大家提供颜色主题,基本原则:色调和谐,风格一致,适合屏幕阅读!

本 issue 长期有效。

章节标题与目录建立超链接的建议

建议章节标题与目录建立超链接,方便阅读。

我参考https://tex.stackexchange.com/questions/32495/linking-the-section-text-to-the-toc,实现了章节标题与目录建立的超链接。代码如下:

\let\oldcontentsline\contentsline%
\renewcommand\contentsline[4]{%
\hypertarget{toc#4}{}%
\oldcontentsline{#1}{#2}{#3}{#4}}

\RequirePackage[explicit]{titlesec}
\renewcommand{\chaptername}{\thechapter .}

\titleformat{\chapter}[\style]{\bfseries}
  {\filcenter\LARGE\enspace\bfseries{\color{structurecolor}\chaptername}\enspace}{1pt}
  {\bfseries\color{structurecolor}\LARGE\filcenter \protect\hyperlink{tocchapter.\thechapter}{#1}}%[\filcenter\base]


\titleformat{\section}[hang]{\bfseries}
  {\Large\bfseries{\color{structurecolor}\thesection}\enspace}{1pt}
  {\color{structurecolor}\Large\bfseries\filright \protect\hyperlink{tocsection.\thesection}{#1}}

\titleformat{\subsection}[hang]{\bfseries}
  {\large\bfseries\color{structurecolor}\thesubsection\enspace}{1pt}
  {\color{structurecolor}\large\bfseries\filright \protect\hyperlink{tocsubsection.\thesubsection}{#1}}

格式请求:增加封底

这么好看的模板缺少一个好看的封底,作者可以增加一个封底吗,有封底的书才是完美的书是吧???

不能调用yhmath宏包

MWE如下
\documentclass[lang=cn]{elegantbook} \usepackage{yhmath} \begin{document} 1 \end{document}
在标准文档类下是可以编译的,报错显示Symbol font 'yhlargesymbols' is not defined.

Elegantbook doesn't work on MikTex!?

I've been using elegantbook for more than a month and finished nearly two chapters. I recently reinstalled MikTex, installed elegantbook package and others , reinstalled TexMaker, refreshed file names, setting etc, and the Chinese fonts. But nothing worked. The elegantbook-cn.tex and all my previous files, which worked fine, failed to generate pdf. Evey time it generated : fatal error occurred. I've been trying all kinds possibilities for two days, and still have no clue. My files in English works fine. I tested a Chinese file using XeLatex, it worked fine as well. (I was using TeXmaker, pdflatex.)
Could anyone point out other possible problems so that I can move on? Thanks a great deal!

中英文档使用的示例颜色不一致

问题描述

在文档的第 2.3 节,中英文版本使用的示例颜色不一致

Position A Position B
cn main structure
en main main

image
image

image

源码位置

\section{颜色主题}
本模板内置 5 组颜色主题,分别为 \textcolor{main1}{\lstinline{green}}\footnote{为原先默认主题}、\textcolor{main2}{\lstinline{cyan}}、\textcolor{main3}{\lstinline{blue}}(默认)、\textcolor{main4}{\lstinline{gray}}、\textcolor{main5}{\lstinline{black}}。另外还有一个自定义的选项 \lstinline{nocolor}。调用颜色主题 \lstinline{green} 的方法为
\begin{lstlisting}
\documentclass[green]{elegantbook} %or
\documentclass[color=green]{elegantbook}
\end{lstlisting}
\begin{table}[htbp]
\caption{ElegantBook 模板中的颜色主题\label{tab:color thm}}
\centering
\begin{tabular}{ccccccc}
\toprule
& \textcolor{structure1}{green}
& \textcolor{structure2}{cyan}
& \textcolor{structure3}{blue}
& \textcolor{structure4}{gray}
& \textcolor{structure5}{black}
& 主要使用的环境\\

\section{Color Themes}
This template contains 5 color themes,they are \textcolor{main1}{\lstinline{green}}\footnote{original default theme.}, \textcolor{main2}{\lstinline{cyan}}, \textcolor{main3}{\lstinline{blue}}(default), \textcolor{main4}{\lstinline{gray}}, \textcolor{main5}{\lstinline{black}}. You can choose \lstinline{green} with
\begin{lstlisting}
\documentclass[green]{elegantbook} %or
\documentclass[color=green]{elegantbook}
\end{lstlisting}
\begin{table}[htbp]
\caption{ElegantBook Themes\label{tab:color thm}}
\centering
\begin{tabular}{ccccccc}
\toprule
& \textcolor{main1}{green}
& \textcolor{main2}{cyan}
& \textcolor{main3}{blue}
& \textcolor{main4}{gray}
& \textcolor{main5}{black}
& Main Environments\\

讨论与建议

main 颜色

  • 问题:cyangreen 主题 main 的差异小,blue 主题的 main 是绿色的

structure 颜色

  • 问题:gray 主题的 structure 颜色是纯黑

目前,建议都改用 structure。长期来看,可能需要调整配色。确认如何修改后,我可以提供 pull request。

关于重新分配 \int 等数学命令使用的符号

  1. 当前,模板提供两种数学字体配置,math = newtx | mtpro2,默认为前者。

  2. math=newtx 时,会加载 newtxmath

  3. newtxmath 会把很多符号定义为较 computer modern 稍粗的版本,

    for those who do not like the integral in txfonts, an emboldened version of the Computer Modern integral is made available, matching the weight of the txfonts symbols
    ref: texdoc newtx, sec. 1

    为了撤销这个修改,模板重新分配了四个常用数学命令(\int, \oint, \sum, \prod)使用的字体

\RequirePackage{newtxtext}
\RequirePackage{anyfontsize}
\ifdefstring{\ELEGANT@math}{newtxmath}{
\RequirePackage{newtxmath}
\let\oldwidering\widering
\let\widering\undefined
\RequirePackage{yhmath}
\let\widering\oldwidering
\RequirePackage{esvect}
\DeclareSymbolFont{CMlargesymbols}{OMX}{cmex}{m}{n}
\let\intop\relax\let\sumop\relax\let\ointop\relax\let\prodop\relax
\DeclareMathSymbol{\sumop}{\mathop}{CMlargesymbols}{"50}
\DeclareMathSymbol{\intop}{\mathop}{CMlargesymbols}{"52}
\DeclareMathSymbol{\ointop}{\mathop}{CMlargesymbols}{"48}
\DeclareMathSymbol{\prodop}{\mathop}{CMlargesymbols}{"51}
}{\relax}

在上述第 3 步中,存在一些风险

  1. 有更多命令可以重定义,例如 \iint
\makeatletter
\ams@renewcommand{\iint}{\DOTSI\protect\MultiIntegral{2}}
\ams@renewcommand{\iiint}{\DOTSI\protect\MultiIntegral{3}}
\ams@renewcommand{\iiiint}{\DOTSI\protect\MultiIntegral{4}}
\renewcommand{\idotsint}{\DOTSI\protect\MultiIntegral{0}}
\def\intkern@{\mkern-6mu\mathchoice{\mkern-8mu}{\mkern-4mu}{}{}}
\makeatother
  1. 因为 newtxmath 使用的字体中,提供了一些 computer modern 没有提供的数学符号,所以仍然存在一些命令(如 \oiint 等),一定无法重定义为 computer modern 风格。

    如果用户需要同时使用重定义过的 \int 和无法重定义的 \oiint,那么总是会遇到符号风格不一致的问题。

  2. 可能的解决方案:

    • esint 宏包
    • stixxits 字体对应的宏包

    以上是与 pdflatex 兼容的方案。如果仅考虑 xelatex,可以考虑 unicode-math 配合 latin modern math(仍然不包括四五个 newtx 包括的、不常用的积分符号), stixxits

修改字体参数导致封面出现异常空白

想把英文字体改成沿用自带的Computer Modern,所以注释掉了如下语句:

% fontsetting
\RequirePackage{ifxetex}
\ifxetex
	\RequirePackage{fontenc}
	\RequirePackage[no-math]{fontspec}
	%\setmainfont{Times New Roman}[NFSSFamily=ntxtlf]
	%\setsansfont{Arial}
...

但是发现这样会导致封面变成这样:
image

heading does not match contents at the end of the chapter (页眉)

The chapter heading seems to follow the section. When I got to the end
of the chapter, say, 第1章 习题,the heading remained to be the last
section, which didn't match the content of the page. (see the
attached.) I'd appreciate it greatly if there would be a command to
switch off the heading or simply to the chapter title.
heading.pdf

副标题不能为空

如果\subtitle为空会在\maketitle出现There is no line here to end,原因是\maketitleelegantbook.cls第700行直接使用的\the\subtitle\\

建议文献编译采用Biber

建议参考文献采用Biber编译,可以十分容易地实现分章节参考文献。

实现代码如下:

% 参考文献设置
\RequirePackage[backend=biber,style=gb7714-2015,refsection=chapter,
    gbnamefmt=givenahead,texencoding=utf8,bibencoding=utf8]{biblatex}
\defbibheading{subbibliography}[\refname]{\section*{参考文献}}
\renewcommand{\bibauthorfont}{\bfseries}
\renewcommand{\bibpubfont}{\itshape}
\setlength{\bibhang}{-1em}

在需要参考文献的地方,用一下命令输出参考文献:

\printbibliography[heading=subbibliography]

option twoside should have switched margins for lang=en

I want to print my book so I use this: \documentclass[a4paper,twoside,fancy,blue,11pt]{elegantbook}

Unfortunatelly the margins are reversed. I guess they are for right-to-left books like Chinese but for left-to-right one they are incorrect. I propose to change the geometry for lang=en option and keep it like it is for lang=cn. I tried to correct it using geometry package but an error occured.

I also propose that when twoside option is used, blank pages are inserted after title page and after unpaired table-of-content page.

How can I fix this quickly?

unicode-math冲突

ElegantBookElegantNoteElegantPaper都存在此问题

(d:/texlive/2018/texmf-dist/tex/latex/unicode-math/unicode-math-table.tex)

! LaTeX3 Error: Control sequence \not= already defined.

For immediate help type H <return>.
 ...

l.3950 \NewNegationCommand { = }    { \neq   }

?

目录页眉的一个小Bug

目录页的页眉有个小Bug,页码不能对齐边沿,见下图

Snipaste_2019-06-09_16-24-33

可以在页眉设置处添加以下代码解决

\fancyheadoffset[LO,LE]{0cm}

建议增加目录双栏排版的开关

建议增加目录双栏排版,使得标题较短的目录更紧凑

实现代码如下:

%%目录双栏排版
\makeatletter
\renewcommand{\tableofcontents}{%
\setlength{\columnsep}{2em}
%\setlength{\columnseprule}{.8pt}
\begin{multicols}{2}[\chapter*{\contentsname}]%
  \@starttoc{toc}%
\end{multicols}}
\makeatother

建议增加参考文献格式的选择

首先非常感谢您们的付出,最近我在整理一些研究笔记,采用的是这个模板,但在使用过程中若用\bibliographystyle{plain}无法设置,导致系统出错。我查看了您们的代码,里面没有这个设置。若能加入这个格式选择,我们作为用户使用起来会有更多的选择。目前正文和参考文献中的显示也不符合国人习惯,最好加上序号,正文中引用也用序号。再次感谢!

US letter paper size

Could you provide support for US letter paper size? This size is 216 x 279 mm, which is different from A4 (210 x 297 mm).

带cn参数后出现`\lvert' already defined等错误

编译环境Ubuntu19.04+TeXLive2019,2019年10月10日,使用sudo tlmgr update --all进行了更新。

无论是使用TXLive2019发行版中的“elegantbook.cls”还是使用Github中的“elegantbook.cls”当使用\documentclass[cn, 11pt]{elegantbook}引入宏包,编译无法通过,出现Command `\lvert' already defined等错误(应该是newtxmath与其它宏包冲突引起的)。

测试代码:

\documentclass[cn, 11pt]{elegantbook}
\begin{document}
  欢迎来到\LaTeX 世界!
\end{document}

但不使用cn参数时,工作正常,如:

\documentclass[11pt]{elegantbook}
\usepackage{ctex}%为了使用中文,若纯英文,也正常
\begin{document}
  欢迎来到\LaTeX 世界!
\end{document}

附件是出错后的log文件。
test.log

文件中的*cn.tex不能通过编译,en.tex可以通过

请教如何解决:

出现的error如下:
newtxmath.sty
786LaTeX Error: Command `\lvert' already defined.
See the LaTeX manual or LaTeX Companion for explanation.
Type H for immediate help.
l.786 ...thopen} {symbols}{106}{largesymbols}{12}

verbatim 跨页报错

报错信息

! Package tikz Error: Sorry, some package has redefined the meaning of the math
-mode dollar sign. This is incompatible with tikz and its calc library and migh
t cause unrecoverable errors.

See the tikz package documentation for explanation.
Type  H <return>  for immediate help.
 ...

l.58 \end{Highlighting}

MWE

\documentclass[cn]{elegantbook}
\usepackage{fancyvrb}
\begin{document}
\vspace*{21cm}
\begin{verbatim}
a
b
c
d
e
f
g
h
i
\end{verbatim}
\end{document}

Ref: annProg/PanBook#27

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.