我想设置示例和定义编号以及它们的字体样式。我找到了以下代码:
\documentclass[letterpaper,12pt,titlepage,oneside,final]{thesis}
\usepackage{lmodern}
\usepackage{mathtools, nccmath}
\usepackage{amsmath,amssymb,amstext,amsfonts} % Lots of math symbols and environments
\newtheorem{thm}{Theorem}
\newtheorem{de}{Defination}
\newtheorem{ex}{Example}
\newtheorem{lem}{Lemma}
\newtheorem{pro}{Proposition}
我的 pdf 文件显示的输出如下: 我想更改写作风格,也想更改示例和定义的编号。我给出了下面的例子。我希望我的示例和定义显示如下: 它将给出章节编号、节编号,然后是定义编号,而不是写作风格。我该怎么做?
答案1
该ntheorem
包中已经预定义了相应的样式:plain
和break
:
\documentclass{report}%]
\usepackage[utf8]{inputenc}%
\usepackage[T1]{fontenc}
\usepackage{mathtools}
\usepackage[thmmarks, amsmath]{ntheorem}%
\theoremheaderfont{\bfseries\upshape}
\theorembodyfont{\normalfont}
\theoremstyle{break}
\theoremseparator{\smallskip}
\newtheorem{defi}{Definition}[section]
\theoremstyle{plain}
\theoremseparator{.}
\newtheorem{example}[defi]{Example}
\setcounter{chapter}{2}
\setcounter{section}{4}
\begin{document}
\begin{defi}[Walsh transform]\setlength\abovedisplayskip{1ex}
The measurement of correlation between the bioolean function $f$ and all of the linear combinations is known as the \textbf{Walsh transform}. The Walsh transform of a boolean function $f$ is defined by
\[ WHT_f{β} = ∑ (-1)^{f(v + β\cdot v)} \qquad∀ v ∈ GF(2^n) \]%
\end{defi}
\begin{example}
Let us consider the example of Walsh transform with boolean.
\end{example}
\end{document}
答案2
您可以使用该amsthm
包并根据需要定义定理样式:
\documentclass[letterpaper,12pt,titlepage,oneside,final]{book}
\usepackage{lmodern}
\usepackage{mathtools, nccmath}
\usepackage{amsmath,amssymb,amstext,amsfonts}
\usepackage{amsthm}
\newtheoremstyle{mystyle}%
{3pt}%
{3pt}%
{\normalfont}%
{}%
{\bfseries}%
{\newline}%
{1em}%
{\thmname{#1}\thmnumber{ #2}\thmnote{ (#3)}}%
\theoremstyle{mystyle}
\newtheorem{de}{Defination}[section]
\newtheoremstyle{inline}%
{3pt}%
{3pt}%
{\normalfont}%
{}%
{\bfseries}%
{}%
{1em}%
{\thmname{#1}\thmnumber{ #2}\thmnote{ (#3)}}%
\theoremstyle{inline}
\newtheorem{ex}[de]{Example}
\begin{document}
\chapter{cap}
\section{sec}
\begin{de}[test]
bla
\end{de}
\begin{ex}
bla
\end{ex}
\end{document}