在我的教科书中偶然发现了类似的东西,我很好奇如何重现这种效果,因为它看起来很干净。我试过 \paragraph{heading},但我找不到正确缩进的方法。
答案1
你可以这样做tabularx
:
\documentclass{scrartcl}
\usepackage[margin=2cm]{geometry}
\usepackage{tabularx}
\usepackage{amssymb,amsmath}
\begin{document}
\begin{tabularx}{\linewidth}{lX}
$\overline{\underline{\textsf{\bfseries PROOF STRATEGY}}}$ &
This result doesn't seem to fit into the kinds of results we've been proving. (This is not unusual. After learning how to prove certain statements, we encounter new statements that require us to ... think.) If we attempt to give either a direct proof or a proof by contrapositive of this result, we may be headed for difficulties. There is, however, another approach. Even though we must be very careful about what we are assuming, from what we know about even and odd integers, it appears that if $5x - 7$ is odd, then $x$ must be even. In fact. if we knew that whenever $5r - 7$ is odd then y is even. this fact would be extremely helpful. We illustrate this next. Don't forget that our goal is to prove the following result, which we will refer to as Result 3.14: Let $x\in\mathbb Z$. If $5x - 7$ is odd then $9x + 2$ is even. The (unusual) numbering of this result is because we will first state and prove a lemma (Lemma 3.13) that will aid us in the proof of Result 3.14.\hfill $\diamondsuit$
\end{tabularx}
\end{document}
答案2
根据列表的解决方案。
\documentclass{article}
\usepackage{array}
\usepackage{amssymb,mathtools}
\usepackage{kantlipsum}
\newcommand\ruled[2]{%
\settowidth{\dimen0}{\sffamily\bfseries#1}%
\sbox0{{\sffamily\bfseries#1}%
\llap{\rule[-0.2\baselineskip]{\dimen0}{0.4pt}}%
\llap{\rule[0.75\baselineskip]{\dimen0}{0.4pt}}}
\begin{list}{}{
\setlength\parsep{0pt}
\setlength\labelwidth{\dimen0}
\setlength\labelsep{1em}
\setlength\listparindent{15pt}
\setlength\leftmargin{\dimen0+1em}
}%
\item[\usebox0]#2\hfill$\blacklozenge$\par
\end{list}
}
\begin{document}
\kant[1][1]
\ruled{PROOF STRATEGY}{\kant*[1]}
\ruled{PROOF}{\kant[1-2]\kant*[3]}
\kant[4][1]
\end{document}
答案3
缩进段落可以通过 来完成\hangindent
,它可以越过分页符并在下一个 时重置\par
。
标题可以采用多种方式;界线亦然。
这里,作为子段落,按照@Celdor 的回答将各行添加为\llap
ped :\rule
作为 a tabular
,其中的行作为 s 出现\hline
(这也说明了长字符串的换行):
行数与\overline
\underline
数学模式相同(根据 Arne 的解决方案):
为了多样化,一个tcolorbox
小插图(默认为棕色框架):
普通的 TikZ 也是一种可能的解决方案(对于线条,也对于所有内容),但对于如此简单的要求来说可能是一个繁重的解决方案。
如果使用基本宏并将其参数化,则可以更轻松地更改子段落标题(使用简单的代码;最终扩展为\par
标题内的标记的代码将会中断)。
颜色:
颜色框:
段落行\hangafter=
参数也可能变化。
宏的默认设置是 hangafter=0 (所有行)
hangafter=4;该空间可用于学生笔记、邮票或贴纸。
相同,标题被推到页面下方(和/或文本被拉上来)。
hangafter=-3 (补码)
当然,非文本也可以放在这个位置:
平均能量损失
\documentclass{article}
\usepackage{xparse} % now in kernel
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{tcolorbox}
\tcbuselibrary{vignette}
% ------------------ heading
\newcommand\sphbeforeskipdefault{\baselineskip}
\newcommand\sphbeforeskip{\sphbeforeskipdefault}
\newcommand\setsphbeforeskip[1]{%
\renewcommand\sphbeforeskip{#1}}
\newcommand\sphrightgapdefault{2em}
\newcommand\sphrightgap{\sphrightgapdefault}
\newcommand\setsphrightgap[1]{%
\renewcommand\sphrightgap{#1}}
% ------------------ par
\newcommand\sphangafterdefault{0}
\newcommand\sphangafter{\sphangafterdefault}
\newcommand\setsphangafter[1]{%
\renewcommand\sphangafter{#1}}
\newcommand\spvskipdefault{-1.8\baselineskip}
\newcommand\spvskip{\spvskipdefault}
\newcommand\setspvskip[1]{%
\renewcommand\spvskip{#1}}
%-1.8\baselineskip
\newcommand\spindentdefault{\noindent}
\newcommand\spindent{\spindentdefault}
%\noindent
\newcommand\spvskipadjdefault{1.8}
\newcommand\spvskipadj{\spvskipadjdefault}
\newcommand\setspvskipadj[1]{%
\renewcommand\spvskipadj{#1}}
%2.3
\ExplSyntaxOn
%****************************************************
%*
%****************************************************
%-------------------- \proofpar
\NewExpandableDocumentCommand \proofpar { O{uppercase} m } {
\renewcommand\sparstylehook{\csname #1\endcsname}
\str_case:nnTF { #1 }
{
{ spnorule } { }
{ spnrbox } { }
{ spnrfcbox } { }
{ spnrcustom } { }
}
{ %T
\subsubparagraph{\xruled*{#2}}
}
{ %F
\subsubparagraph{\xruled{#2}}
}
\vskip\spvskip %\vskip-1.8\baselineskip
\spindent %\noindent
\hangindent=\g_tmpb_dim
\hangafter=\sphangafter
}
%****************************************************
%*
%****************************************************
%-------------------- xRuled
\NewExpandableDocumentCommand \xruled { s m } {
\tl_set:Nn \l_tmpa_tl { #2 }
\hbox_set:Nn \l_tmpa_box { \l_tmpa_tl }
\dim_gset:Nn \g_tmpb_dim { \box_wd:N \l_tmpa_box + \sphrightgap }
\dim_set:Nn \l_tmpb_dim { \box_wd:N \l_tmpa_box }
\IfBooleanTF{#1}
{
\hbox_set_to_wd:Nnn
\l_tmpb_box
{ \box_wd:N \l_tmpa_box }
{
\l_tmpa_tl
% \llap{\rule[-0.2\baselineskip]{\dim_use:N \l_tmpb_dim}{ 0.6pt }}
% \llap{\rule[0.75\baselineskip]{\dim_use:N \l_tmpb_dim}{ 0.6pt }}
}
}
{
\hbox_set_to_wd:Nnn
\l_tmpb_box
{ \box_wd:N \l_tmpa_box }
{
\l_tmpa_tl
\llap{\rule[-0.2\baselineskip]{\dim_use:N \l_tmpb_dim}{ 0.6pt }}
\llap{\rule[0.75\baselineskip]{\dim_use:N \l_tmpb_dim}{ 0.6pt }}
}
}
\box_use_drop:N
\l_tmpb_box
}
%****************************************************
%*
%****************************************************
%-------------------- \boxpar
\NewExpandableDocumentCommand \boxpar { m } {
\tl_set:Nn \l_tmpa_tl { #1 }
\hbox_set:Nn \l_tmpa_box { \l_tmpa_tl }
\dim_gset:Nn \g_tmpb_dim { \box_wd:N \l_tmpa_box + \sphrightgap }
\dim_set:Nn \l_tmpb_dim { \box_wd:N \l_tmpa_box }
\dim_set:Nn \l_tmpa_dim { \spvskipadj \box_ht:N \l_tmpa_box }% + \spvskipadj\baselineskip }
\hbox_set_to_wd:Nnn
\l_tmpb_box
{ \box_wd:N \l_tmpa_box }
{
\l_tmpa_tl
}
\box_use_drop:N
\l_tmpb_box
\vskip-\l_tmpa_dim %\spvskip %\vskip-1.8\baselineskip
\spindent %\noindent
\hangindent=\g_tmpb_dim
\hangafter=\sphangafter
}
\ExplSyntaxOff
% ------------------ heading style
\newcommand{\sparstylehook}{}
\newcommand{\spnop}[1]{#1}
\newcommand{\spblue}[1]{\textcolor{blue}{#1}}
\newcommand{\spbox}[1]{\fbox{#1}}
\newcommand{\spfcbox}[1]{\fcolorbox{blue}{yellow}{#1}}
\newcommand{\spnorule}[1]{#1}
\newcommand{\spnrbox}[1]{\fbox{#1}}
\newcommand{\spnrfcbox}[1]{\fcolorbox{blue}{yellow!50}{#1}}
\newcommand{\spnrcustom}[1]{%
#1%
}
\newcommand{\sptable}[1]{%
#1%
}
\makeatletter
%
\newcounter{subsubparagraph}[subparagraph]% counter for numbering
\renewcommand{\thesubsubparagraph}% how to display
{\thesubparagraph.\@Alph\c@subsubparagraph}% numbering
\newcommand{\subsubparagraph}{\@startsection
{subsubparagraph}%
{6}% [level]
{0em}% [indent]
{\sphbeforeskip}% [beforeskip]
{1pt}% [afterskip]
{\sffamily\large\bfseries\sparstylehook}}% [style]
\newcommand*\l@subsubparagraph{\@dottedtocline{7}{12em}{5em}}% for toc
\newcommand{\subsubparagraphmark}[1]{}% for page headers
\makeatother
%
\newcommand\texta{The cat sat on the mat and the quick brown fox jumps over the lazy dog.\ }
\newcommand\textb{\texta\texta}
\newcommand\textc{\textb\textb}
\newcommand\textd{\textc\textc\textc\hfill$\diamondsuit$\par\textb}
\begin{document}
\section{section}
xxx
\subsection{subsection}
xxx
\subsubsection{subsubsection}
xxx
\paragraph{paragraph}
xxx
\subparagraph{subparagraph}
xxx
\proofpar{proof strategy}
1: \textc
yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy
\proofpar{proof}
yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy yyy
\proofpar{A Voyage to Arcturus}
2: \textc\textc\textc\par\textb
{
\setsphangafter{4}
\setspvskip{0.5\baselineskip}
\proofpar{A Voyage to Arcturus}
3: hangafter=4; vskip 0.5 baselineskip \textc\textc\textc\par\textb
}
{
\setsphbeforeskip{5\baselineskip}
\setspvskip{-5.5\baselineskip}
\setsphangafter{3}
\proofpar{A Voyage to Arcturus}
4: sphbeforeskip=5 baselineskip ; sphangafter=3, spvskip -5.5 baselineskip \textc\textc\textc\par\textb
}
{
\setsphangafter{-3}
\proofpar{A Voyage to Arcturus}
5: sphangafter=-3
\textc\textc\textc\par\textb
}
\proofpar{A Voyage to Arcturus}
6: default \textd
\proofpar[spnorule]{A Voyage to Arcturus}
7: spnorule \textd
\proofpar[spnop]{A Voyage to Arcturus}
8: spnop \textd
\proofpar[spblue]{A Voyage to Arcturus}
9: spblue \textd
{
\setsphrightgap{3em}
\proofpar[spnrbox]{A Voyage to Arcturus}
10: spnrbox \textd
}
{
\setsphrightgap{3em}
\proofpar[spnrfcbox]{A Voyage to Arcturus}
11: spnrfcbox \textd
}
{
\setspvskip{-3.8\baselineskip}
\proofpar[spnrcustom]{\hbox{\begin{tabular}{c}A Voyage\\ to\\ Arcturus\\\end{tabular}}}
12: spnrcustom = tabular \textd
}
{
\setspvskip{-4.8\baselineskip}
\proofpar[spnrcustom]{\colorbox{blue!10}{\begin{tabular}{c}A Voyage\\ to\\ Arcturus\\\end{tabular}}}
13: spnrcustom = cb tabular \textd
}
{
\vspace{\baselineskip}
\begin{tikzpicture}%
\node[draw,fill=blue!60] (A) {%
\colorbox{blue!10}{\begin{tabular}{c}A Voyage\\ to\\ Arcturus\\\end{tabular}}%
};%
\tcbvignette{outside node=A}%
\end{tikzpicture}%
%}}
\vskip-5.2\baselineskip
\noindent
\hangindent=1.5in
\hangafter=0
14: tcolorbox vignette \textd
}
{
%\vspace{2\baselineskip}
\boxpar{\colorbox{blue!10}{\begin{tabular}{c}\hline\rule{0pt}{2.5ex}A Voyage\\to\\ Arcturus\\\hline \end{tabular}}}
15: boxpar cb tabular \textd
}
{
\vspace{2\baselineskip}%
\setspvskipadj{2.3}%
\boxpar{\colorbox{blue!10}{\sffamily\large\bfseries\begin{tabular}{c}\hline\rule{0pt}{2.5ex}\MakeUppercase{A Voyage}\\\MakeUppercase{to}\\\MakeUppercase{Arcturus}\\\hline \end{tabular}}%
}
16: boxpar cb + fonts + tabular \textd
}
{
\vspace{2\baselineskip}
\setspvskipadj{1.3}%
\boxpar{%
\begin{tikzpicture}%
\node[draw,fill=blue!60] (A) {%
\colorbox{blue!10}{\begin{tabular}{c}A Voyage\\ to\\ Arcturus\\\end{tabular}}%
};%
\tcbvignette{outside node=A}%
\end{tikzpicture}%
}
17: boxpar tcolorbox vignette \textd
}
{
\vspace{2\baselineskip}
\setspvskipadj{1.3}%
\boxpar{%
\begin{tikzpicture}%
\node[draw,fill=blue!60] (A) {{\sffamily\large\bfseries%
\colorbox{blue!10}{\begin{tabular}{c}A Voyage\\ to\\ Arcturus\\\end{tabular}}%
}};%
\tcbvignette{outside node=A}%
\end{tikzpicture}%
}
18: boxpar tcolorbox vignette \textd
}
{
\vspace{2\baselineskip}
\setspvskipadj{1.3}%
\boxpar{%
\begin{tikzpicture}%
\node[draw,fill=blue!60] (A) {{\sffamily\large\bfseries%
\colorbox{blue!10}{\begin{tabular}{c}\rule{0pt}{2.5ex}\MakeUppercase{A Voyage}\\\MakeUppercase{to}\\\MakeUppercase{Arcturus}\\\end{tabular}}%
}};%
\tcbvignette{outside node=A}%
\end{tikzpicture}%
}
19: boxpar tcolorbox vignette \textd
}
{
\vspace{2\baselineskip}
\setspvskipadj{1.1}%
\boxpar{%
\begin{tikzpicture}%
\node[draw,fill=blue!60] (A) {{\sffamily\large\bfseries%
\includegraphics[width=1in]{example-image-duck-portrait}%
}};%
\tcbvignette{outside node=A}%
\end{tikzpicture}%
}
20: boxpar tcolorbox vignette image \textd
}
{
\vspace{2\baselineskip}
\setspvskipadj{1.1}%
\boxpar{%
\includegraphics[width=1in]{example-image-duck}%
}
21: boxpar image \textd
}
{
\vspace{2\baselineskip}
{\large\bfseries$\overline{\rule{0pt}{2.1ex}\underline{\textsf{PROOF STRATEGY}}}$}
\vskip-1.8\baselineskip
\noindent
\hangindent=2in
\hangafter=0
22: manual overline underline \textd
}
{
\vspace{2\baselineskip}
\proofpar[spnrcustom]{\hbox{{$\overline{\rule{0pt}{2.1ex}\underline{\textsf{PROOF STRATEGY}}}$}}}
% \vskip-1.8\baselineskip
% \noindent
% \hangindent=2in
% \hangafter=0
23: auto overline underline \textd
}
\end{document}
答案4
proof
您可以强制使用 的标准环境amsthm
。
\documentclass{article}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{kantlipsum}
\newlength{\modproofwd}
\newenvironment{modproof}[1]{%
\settowidth{\modproofwd}{\normalfont\sffamily\bfseries\MakeUppercase{#1}}%
\begin{list}{}{\leftmargin=\dimexpr\modproofwd+1em\relax}\item\relax
\renewcommand{\qedsymbol}{\ensuremath{\blacklozenge}}%
\begin{proof}[\makeheader{#1}]\hspace*{-\labelsep}\ignorespaces
}{\end{proof}\end{list}}
\newcommand{\makeheader}[1]{%
\makebox[0pt][r]{%
\parbox[t]{\modproofwd}{%
\parbox[b]{\modproofwd}{%
\hrule\vspace{2pt}
\normalfont\sffamily\bfseries\MakeUppercase{#1}
}%
\vspace{2pt}\hrule
}%
\quad
}\spacefactor=3000 % so proof doesn't add a period
}
\begin{document}
\kant[1][1-3]
\begin{modproof}{Proof Strategy}
\kant*[2][1-2]
\end{modproof}
\kant[3][1-3]
\begin{modproof}{Proof Strategy}
\kant*[2][1-3]
\end{modproof}
\kant[5][1-3]
\end{document}