我有一个问题需要解决。这里的问题是,我希望证明环境中的下一行也加粗等等,请考虑以下 MWE:
\documentclass[10pt, welsh, english, a4paper]{report}
\PassOptionsToPackage{english}{babel}
\usepackage[margin=1in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{siunitx}
\usepackage{microtype}
\usepackage{fancyhdr}
\usepackage{amsmath}
\usepackage{enumitem,url,fancyref}
\usepackage{amsthm}
\newtheorem*{theorem*}{Theorem}
\newtheorem{theorem}{Theorem}[section]
\newtheorem*{corollary*}{Corollary}
\newtheorem{corollary}{Corollary}[theorem]
\newtheorem*{lemma*}{Lemma}
\newtheorem{lemma}[theorem]{Lemma}
\expandafter\let\expandafter\oldproof\csname\string\proof\endcsname
\let\oldendproof\endproof
\renewenvironment{proof}[1][\proofname]{%
\oldproof[\Large \color{red}{\textbf{Proof}}]%
}{\oldendproof}
%Removing the punctuation from Proof environment and, note environment is the correct spelling of that word.
\usepackage{etoolbox} % etoolbox defines the command 'AtBeginEnvironment'
\makeatletter
\AtBeginEnvironment{proof}{\let\@addpunct\@gobble}
\makeatother
\title{LaTeX document for testing and faster compilations prior to organizing into other documents}
\author{Faycal Kilali\thanks{"It is not knowledge, but the act of learning, not possession but the act of getting there, which grants the greatest enjoyment." - Carl Friedrich Gauss}}
\date{\today}
\begin{document}
\begin{titlepage}
\maketitle
\end{titlepage}
\section{Placeholder section}
\begin{theorem}\label{thm:9.2}
If a connected plane graph has v vertices, e edges and f faces, then \begin{gather}
v - e + f = 1 \label{thm:9.2:1}
\end{gather}
\end{theorem}
\begin{proof}{Proof of \Autoref{thm:9.2}}
Here is the statement p(n) we are going to try to prove by induction: \\ p(n): every connected plane graph with n edges satisfies the formula \(v - n + f = 1\).
Notice that p(n) is a statement about lots of plane graphs. p(1) says that every connected plane graph with 1 edge satisfies the formula; there is only one such graph:
\end{proof}
但是我希望大红色加粗的“证明”字母也能影响下一部分“定理 1.1 的证明”的风格,我该如何实现呢?
答案1
您似乎想proof
用强制性论点重新定义。
\NewCommandCopy{\oldproof}{\proof}
\NewCommandCopy{\endoldproof}{\endproof}
\renewenvironment{proof}[1]
{\oldproof[\Large\bfseries\color{red}#1]}
{\endoldproof}
如果你的 LaTeX 版本早于 2020-10-01,你需要加载该letltxmacro
包并使用
\LetLtxMacro{\oldproof}{\proof}
\LetLtxMacro{\endoldproof}{\endproof}
而不是\NewCommandCopy
命令。
这是文档相关部分的编辑版本。我删除了示例不需要的标题部分。
数学公式应该总是应按此方式输入。单个方程式不应使用gather
。
没有\Autoref
我改成的\autoref
。您没有加载xcolor
和hyperref
。您还将选项传递给了 而babel
没有加载它。如果您english
在选项中说 ,那么\documentclass
再次传递相同的选项是没有意义的。
\documentclass[10pt, welsh, english, a4paper]{report}
\usepackage{babel}
\usepackage[margin=1in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{siunitx}
\usepackage{microtype}
\usepackage{fancyhdr}
\usepackage{amsmath}
\usepackage{enumitem,url,fancyref}
\usepackage{amsthm}
\usepackage{xcolor}
\usepackage{etoolbox} % etoolbox defines the command 'AtBeginEnvironment'
\usepackage{hyperref}
\newtheorem*{theorem*}{Theorem}
\newtheorem{theorem}{Theorem}[section]
\newtheorem*{corollary*}{Corollary}
\newtheorem{corollary}{Corollary}[theorem]
\newtheorem*{lemma*}{Lemma}
\newtheorem{lemma}[theorem]{Lemma}
\NewCommandCopy{\oldproof}{\proof}
\NewCommandCopy{\oldendproof}{\endproof}
\renewenvironment{proof}[1]
{\oldproof[\Large\bfseries\color{red}#1]}
{\oldendproof}
%Removing the punctuation from proof environment
\makeatletter
\AtBeginEnvironment{proof}{\let\@addpunct\@gobble}
\makeatother
\begin{document}
\section{Placeholder section}
\begin{theorem}\label{thm:9.2}
If a connected plane graph has $v$ vertices, $e$ edges and $f$ faces, then
\begin{equation}
v - e + f = 1 \label{thm:9.2:1}
\end{equation}
\end{theorem}
\begin{proof}{Proof of \autoref{thm:9.2}}
Here is the statement \(p(n)\) we are going to try to prove by induction:
\begin{quote}
\(p(n)\): every connected plane graph with $n$ edges satisfies the formula \(v - n + f = 1\).
\end{quote}
Notice that \(p(n)\) is a statement about lots of plane graphs.
\(p(1)\) says that every connected plane graph with one edge satisfies the formula;
there is only one such graph:
\end{proof}
\end{document}
你真的想打读者的眼球吗?