\fbox
下面是一个 MWE,它在多个段落中显示该命令的使用方法:
\documentclass{book}
\usepackage{lipsum}
\usepackage{xcolor}
\begin{document}
\parskip 10pt
\Large
{\color{red}{\textbf{\fbox{1.}}}} I would like to (permanently) add a little bit of horizontal space between the boxed number and the first word of the sentence following it---so that whenever I invoke the fbox command in the document, it adds such a horizontal space automatically.
{\color{red}{\textbf{\fbox{2.}}}} \lipsum[13]
{\color{red}{\textbf{\fbox{3.}}}} \lipsum[14]
\end{document}
如何\fbox
重新定义命令以增加它生成的框与以下句子的第一个单词之间的默认空间?
答案1
您想定义自己的命令:
\newcommand{\start}[1]{%
\par
\textcolor{red}{\fbox{\bfseries #1.}}%
\hspace{0.8em}% or what you prefer
\ignorespaces
}
完整示例;第三次调用表明无论后面是否有空格都无关紧要\start{3}
。
\documentclass{book}
\usepackage{xcolor}
\usepackage{parskip}
\usepackage{lipsum}
\newcommand{\start}[1]{%
\par
\textcolor{red}{\fbox{\bfseries #1.}}%
\hspace{0.8em}% or what you prefer
\ignorespaces
}
\begin{document}
\start{1} I would like to (permanently) add a little bit of
horizontal space between the boxed number and the first word
of the sentence following it---so that whenever I invoke the
fbox command in the document, it adds such a horizontal space
automatically.
\start{2} \lipsum[13]
\start{3}\lipsum[14]
\end{document}