在 Texstudio (Ubuntu) 中设置示例和定义

在 Texstudio (Ubuntu) 中设置示例和定义

我想设置示例和定义编号以及它们的字体样式。我找到了以下代码:

\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 文件显示的输出如下: 示例](https://i.stack.imgur.com/MGBy6.png)![1] 我想更改写作风格,也想更改示例和定义的编号。我给出了下面的例子。我希望我的示例和定义显示如下: 示例2](https://i.stack.imgur.com/Wt0o9.png)[2]! 它将给出章节编号、节编号,然后是定义编号,而不是写作风格。我该怎么做?

答案1

ntheorem包中已经预定义了相应的样式:plainbreak

\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}

在此处输入图片描述

相关内容