简体   繁体   English

如何禁用乳胶编号?

[英]How to disable numbering in latex?

I am new to latex and I wrote the below tex code on Texmaker editor. 我是乳胶新手,我在Texmaker编辑器上写了下面的tex代码。

What I want to do is to add the "University" section without any numbering preceeding it and to be centered horizontally, because when I run the code I find that the word "University" is displayed but it is preceeded by a number and I do not want to display any number preceeding that word. 我想要做的是添加“大学”部分,在它之前没有任何编号并且水平居中,因为当我运行代码时,我发现显示“大学”这个词,但它前面有一个数字,我做的不希望在该单词之前显示任何数字。

code : 代码

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{kpfonts}
\author{Anan}
\pagestyle{plain}
\begin{document}
\section{University}
\end{document}
\section*{\centering University}
    % * removes numbering for _this_ \section instance, 
    % \centering within environment centres the title.

Note however, that this is a local solution, and that it's better practice (and easier for you to make later document-global changes) to re-define the \\section , \\subsection , ... environments using the titlesec package, as is described well in Alan Munn:s answer in the following tex.stackexchange thread: 但请注意,这是一个本地解决方案,并且使用titlesec包重新定义\\section\\subsection ,...环境是更好的做法(并且更容易使以后的文档全局更改)在Alan Munn中很好地描述了:在以下tex.stackexchange线程中回答:

All you have to do is to edit your line 9: 您所要做的就是编辑第9行:

\section{University}

this way: 这条路:

\section*{\centering University}

since the command \\section* produces unnumbered sections. 因为命令\\section*产生无编号的部分。

Further, if you want to to include an unnumbered section to your table of contents, you can add 此外,如果要将未编号的部分包含在目录中,可以添加

\addcontentsline{toc}{section}{University}

(this time without \\centering ) just after. (这次没有 \\centering )就在之后。 The resulting code: 结果代码:

\documentclass[12pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{kpfonts}
\author{Anan}
\pagestyle{plain}
\begin{document}
\tableofcontents
\section*{\centering University}
\addcontentsline{toc}{section}{University}
Text.
\end{document}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM