nuaatug / nuaathesis

LaTeX document class for NUAA, supporting bachelor/master/PH.D thesis in Chinese/English/Japanese. 南航本科、硕士、博士学位论文 LaTeX 模板
Apache License 2.0
299 stars 68 forks source link

Package titlesec Error: Entered in horizontal mode #53

Closed sahintelli closed 3 years ago

sahintelli commented 3 years ago

Hello folks! Files are successfully installed and compiled without an error, and everything seems great. I appreciate the nice work and efforts. I wanted to have chapter titles appear in table of contents as the following: Chapter 1 Chapter Title. 1.1 Section Title Chapter 2 Chapter Title. 2.1 Section Title and so on

When I leave the asterisk from chapter command, changing from \chapter*{Windows TIPS} to \chapter{Windows TIPS} for instance, I receive the following error referring to windows.tex .

Undefined control sequence. \chapter{Windows TIPS} Package titlesec Error: Entered in horizontal mode. \chapter{Windows TIPS}

I checked with the Chinese version of master.tex. I received the same error. Undefined control sequence. \chapter{快速上手} Package titlesec Error: Entered in horizontal mode. \chapter{快速上手}

I realized the text is generated anyway, and the table of contents looks the way I want it to be. However, When I go to the page where chapter starts it seems like another "Chapter 1 Windows TIPS" appears with different font type and size. I thought that it would make sense if the documentclass was article rather than book or report. So, do you have any opinion? How can we fix this problem?

error

yzwduck commented 3 years ago

Hi Tellisahin, I can reproduce this issue (if I deleted temporary files generated by TeXLive 2019 and tried a fresh compile). It seems to be another package compatibility issue and I cannot figure out its root cause right now.

As a workaround, I suggest deleting following lines from nuaathesis.cls directly (or modifying nuaathesis.dtx and regenerating nuaathesis.cls). It will slightly change the paper format and I will try to fix it this weekend.

diff --git a/nuaathesis.dtx b/nuaathesis.dtx
index deb544b..a73bccb 100644
--- a/nuaathesis.dtx
+++ b/nuaathesis.dtx
@@ -1379,8 +1379,6 @@ and the derived files           nuaathesis.ins,
 % 本节设置各级标题的字体、字号、行间距、编号格式等。
 % \mac{chapter} 会在页首引入一定空格,计算方法未知,除此以外都是仿照 Word 的格式准确设置。
 %    \begin{macrocode}
-\renewcommand\chaptermark[1]{%
-  \markleft{\CTEXifname{\nuaa@chaptername~}{}#1}}
 \ifnuaa@bachelor
   \renewcommand\thesubsubsection{(\arabic{subsubsection})}
   \titleformat{\chapter}
sahintelli commented 3 years ago

Everything is smooth and working great. Thank you so much for your time and valuable suggestion. 👍