|
回复 6# kuing
我用的是二楼的那个,示例代码如下,如果把那个“去掉无 section 的环境编号 0”下边那段用iffalse注释掉和不注释掉,就出现5楼的现象。- \documentclass[a4paper]{book}
- \usepackage{amsmath,bm,yhmath,amssymb,etoolbox,esvect,stmaryrd,cite,enumitem,extarrows,mathtools,ifthen}
- \usepackage{etoolbox}
- %定理环境
- \usepackage[amsmath, thmmarks]{ntheorem}
- {
- \theoremstyle{nonumberplain}
- \theoremheaderfont{\indent\bfseries}
- \theorembodyfont{\normalfont}
- \theoremsymbol{\ensuremath{\Box}}
- \newtheorem{proof}{证明}
- }
- \newtheorem{example}{例}[section]
- \newcommand\exampleautorefname{例}
- % 去掉无 section 的环境编号 0
- \makeatletter
- \renewcommand\theexample{
- \ifnum\c@section=0\relax
- \thechapter.\arabic{example}
- \else
- \thesection.\arabic{example}
- \fi
- }
- \makeatother
- \iffalse
- \fi
- \usepackage[pdfencoding=auto,psdextra,colorlinks,linkcolor=red,anchorcolor=blue,citecolor=blue]{hyperref}
- % 字体
- \usepackage[slantfont,boldfont]{xeCJK}
- \punctstyle{kaiming}
- \begin{document}
- \chapter{first}
- \begin{example}\label{exam01}
- example01
- \end{example}
- ref\autoref{exam01}
- \end{document}
复制代码 |
|