如何减少\begin{mq} … \end{mq}
以下代码中块前后的空白?理想情况下,我希望环境与前后段落之间的空白为 1em。与环境块外的段落之间的空白相同。
\documentclass[12pt, openany]{book}
% Page Setup
\usepackage[paperheight=8in,
paperwidth=6in,
top=.1in,
bottom=.2in,
right=.1in,
left=.1in,
heightrounded]{geometry}
% Set space between paragraphs
\setlength{\parskip}{1em}
% Custom Quotation Environment
\newenvironment {mq} %My Quote
{
\ignorespaces
\begin{list}{}
{
\setlength{\leftmargin}{1cm}
\setlength{\rightmargin}{1cm}
\setlength{\parindent}{0pt}
}
\item % Inserted text
}
{\end{list} \par \ignorespacesafterend}
\usepackage{lipsum}
\begin{document}
\lipsum[1-2]
\begin{mq}
Average wage of employees \dotfill\ $\$\,2,200$\\
Average salary and profit of owners \dotfill\ $\$\,26,000$\\
\end{mq}
\lipsum[1-2]
\end{document}
答案1
\documentclass[12pt, openany]{book}
% Page Setup
\usepackage[paperheight=8in,
paperwidth=6in,
top=.1in,
bottom=.2in,
right=.1in,
left=.1in,
heightrounded]{geometry}
% Set space between paragraphs
\setlength{\parskip}{1em}
% Custom Quotation Environment
\newenvironment {mq} %My Quote
{%
%\ignorespaces
\begin{list}{}%
{%
\setlength{\leftmargin}{1cm}%
\setlength{\rightmargin}{1cm}%
\setlength{\parindent}{0pt}%
\setlength\partopsep{0em}%
\setlength\parsep{0pt}%
\setlength\topsep{0pt}%
\setlength\itemsep{0pt}%
}
\item\relax % Inserted text
}
{\end{list}%
\ignorespacesafterend}
\usepackage{lipsum}
\begin{document}
\lipsum[1-2]
\begin{mq}
Average wage of employees \dotfill\ $\$\,2,200$\\
Average salary and profit of owners \dotfill\ $\$\,26,000$%\\
\end{mq}
\lipsum[1-2]
\end{document}
答案2
使用适当的工具。
\documentclass[12pt, openany]{book}
% Page Setup
\usepackage[paperheight=8in,
paperwidth=6in,
top=.1in,
bottom=.2in,
right=.1in,
left=.1in,
heightrounded]{geometry}
\usepackage{chngpage}
\usepackage{lipsum}
% Set space between paragraphs
\setlength{\parskip}{1em}
% Custom Quotation Environment
\newenvironment {mq} %My Quote
{\partopsep=0pt \adjustwidth{1cm}{1cm}}
{\endadjustwidth}
\begin{document}
\lipsum[2-3]
\begin{mq}
Average wage of employees \dotfill\ $\$\,2{,}200$\\
Average salary and profit of owners \dotfill\ $\$\,26{,}000$
\end{mq}
\lipsum[4]
\end{document}