在最基本的层面上我希望能够做这样的事情:
\begin{quote}[5.5.2]
This is some text that will come out like a quote.
\end{quote}
这样就会出现类似这样的结果。
5.5.2 This is some text that will
come out like a quote.
我想我希望能够做一些事情,比如减小 5.5.2 的字体、更改颜色、添加边框线等。我猜想我想做一些事情\newenvironment
,但我不知道要在其中放什么,查看帮助后我不知道从哪里开始。
\newenvironment{aquote}[2]
{\begin{quote}}
{\end{quote}}
或者也许更容易不从里面引用开始,而只是以某种方式画两个框?
更新:
感谢下面提供的出色指示,下面是如何以最基本的形式实现此目的:
\minipage[t]{2cm}{\textcolor{red}{Stuff}}\endminipage
\minipage[t]{\textwidth}
here is just some more text. Welcome to Overleaf just edit your LaTeX on the left, and we'll compile it for you on the right. If you give
someone the link to this. Good bye.
\endminipage
或者像这样:
\makebox[2cm][r]{Stuff}
\minipage[t]{\textwidth}
Here is just some more text. Welcome to Overleaf just edit your LaTeX on the left, and we'll compile it for you on the right. If you give
someone the link to this. Good bye.
\endminipage
答案1
使用 KOMA-Script(KOMA-Script 类或 KOMA-Script 包scrextend
),您可以使用以下labeling
环境:
\documentclass{article}
\usepackage{xcolor}
\usepackage{scrextend}
\newenvironment{aquote}[1]{%
\setkomafont{labelinglabel}{\color{blue}}%
\small
\labeling{#1}\item[#1]%
}{%
\endlabeling
}
\usepackage{blindtext}
\begin{document}
\blindtext
\begin{aquote}{5.5.2}
\blindtext
\end{aquote}
\blindtext
\end{document}
您还可以使用以下addmargin
环境:
\documentclass{article}
\usepackage{xcolor}
\usepackage{scrextend}
\newenvironment{aquote}[1]{%
\addmargin[4em]{1.5em}%
\small
\makebox[0pt][r]{\textcolor{green}{#1}\quad}\ignorespaces
}{%
\endaddmargin
}
\usepackage{blindtext}
\begin{document}
\blindtext
\begin{aquote}{5.5.2}
\blindtext
\end{aquote}
\blindtext
\end{document}
另一个建议是使用enumitem
设置新description
环境:
\documentclass{article}
\usepackage{xcolor}
\usepackage{enumitem}
\newlist{aquote}{description}{1}
\setlist[aquote]{font=\color{green},align=right,labelindent=1em,labelwidth=*,leftmargin=3.5em,rightmargin=1.5em,before=\small}
\usepackage{blindtext}
\begin{document}
\blindtext
\begin{aquote}
\item[5.5.2]
\blindtext
\end{aquote}
\blindtext
\end{document}
绝对最小的建议是使用minipage
:
\documentclass{article}
\usepackage{enumitem}
\usepackage{calc}
\usepackage{xcolor}
\newenvironment{aquote}[1]{%
\textcolor{red}{#1}
\minipage[t]{\linewidth-\widthof{#1 }}%
}{\endminipage}
\usepackage{blindtext}
\begin{document}
\blindtext
\begin{aquote}{5.5.2}
\blindtext
\end{aquote}
\blindtext
\end{document}
aquote
但在这种情况下不允许内部分页。