我该怎么做才能使 svmono 的灰色框正确对齐?

我该怎么做才能使 svmono 的灰色框正确对齐?

我正在使用文档类svmono.cls,版本 v5.5,2009/12/17,写一本书。我在获取灰框环境生成灰色框,其边缘与外部文本的边缘对齐,并且其文本内容的边缘在框内对称对齐。

下面给出的样本文本中的灰色框说明了我的问题。样本文本 1 摘自例子.pdfSpringer 提供的文件。它显示了所需的灰色框。示例文本 2。显示了我实际得到的灰色框。它与我应该得到的有很大不同。

示例文本 1示例文本 1。

在此处输入图片描述示例文本 2。

产生示例文本 2 的 MWE 代码如下所示。

\documentclass[graybox,envcountchap,sectrefs]{svmono}
\usepackage{mathptmx}
\usepackage{helvet}
\usepackage{courier}
\usepackage{type1cm}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage{multicol}
\usepackage[bottom]{footmisc}

\begin{document}
\setcounter{chapter}{1} 
\setcounter{section}{3}
\subsection{Subsection Heading}%
In order to avoid simply listing headings of different levels we recommend
to let every heading be followed by at least a short passage of text.
Use the \LaTeX automatism for all your cross-references and citations
citations as has already been described in Sect. 1.2.

Please note that the first line of text that follows a heading is not
indented, whereas the first lines of all subsequent paragraphs are.

\begin{svgraybox}
If you want to emphasize complete paragraphs of texts we recommend to use
the newly defined Springer class option \verb|graybox| and the newly
defined environment \verb|svgraybox|. This will produce a 15 percent
screened box 'behind' your text.

If you want to emphasize complete paragraphs of texts we recommend to use
the newly defined Springer class option and environment \verb|svgraybox|.
This will produce a 15 percent screened box 'behind' your text.
\end{svgraybox}

\end{document}

答案1

类中的定义svgraybox是错误的:它将右边距设置为 24pt,结果正是您所看到的。

\documentclass[graybox,envcountchap,sectrefs]{svmono}
\usepackage{newtxtext,newtxmath}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage{multicol}
\usepackage[bottom]{footmisc}

\makeatletter
\renewenvironment{svgraybox}%
  {\begin{shaded}%
   \list{}{\leftmargin=\z@\rightmargin=\z@\topsep=\z@}%
   \expandafter\item\parindent=\svparindent
   \hskip-\listparindent}
  {\endlist\end{shaded}}
\makeatother

\begin{document}
\setcounter{chapter}{1} 
\setcounter{section}{3}
\subsection{Subsection Heading}
In order to avoid simply listing headings of different levels we recommend
to let every heading be followed by at least a short passage of text.
Use the \LaTeX automatism for all your cross-references and citations
citations as has already been described in Sect. 1.2.

Please note that the first line of text that follows a heading is not
indented, whereas the first lines of all subsequent paragraphs are.

\begin{svgraybox}
If you want to emphasize complete paragraphs of texts we recommend to use
the newly defined Springer class option \verb|graybox| and the newly
defined environment \verb|svgraybox|. This will produce a 15 percent
screened box 'behind' your text.

If you want to emphasize complete paragraphs of texts we recommend to use
the newly defined Springer class option and environment \verb|svgraybox|.
This will produce a 15 percent screened box 'behind' your text.
\end{svgraybox}

\end{document}

在此处输入图片描述

我建议用newtxtextnewtxmath代替mathptmx。不过你可以用你喜欢的任何方式。

答案2

感谢@egreg 对我所提问题的回复,我已成功使用下面给出的代码获取所需的灰色框。我的灰框环境是 egreg 所建议的形式的稍微修改的形式。

\documentclass[graybox,envcountchap,sectrefs]{svmono}
\usepackage{newtxtext,newtxmath}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage{multicol}
\usepackage[bottom]{footmisc}

\makeatletter
\renewenvironment{svgraybox}
  {\begin{shaded*}%
   \list{}{\leftmargin=\p@\rightmargin=\p@\topsep=\p@}%
   \expandafter\item\parindent=\svparindent
   \hskip-\listparindent}
  {\endlist\end{shaded*}}
\makeatother

\begin{document}
\setcounter{chapter}{1} 
\setcounter{section}{3} 
\subsection{Subsection Heading}%
In order to avoid simply listing headings of different levels we recommend
to let every heading be followed by at least a short passage of text.
Use the \LaTeX\ automatism for all your cross-references and citations
citations as has already been described in Sect. 1.2.

Please note that the first line of text that follows a heading is not     
indented, whereas the first lines of all subsequent paragraphs are.

\begin{svgraybox}
If you want to emphasize complete paragraphs of texts we recommend to use
the newly defined Springer class option \verb|graybox| and the newly
defined environment \verb|svgraybox|.
This will produce a 15 percent screened box 'behind' your text.

If you want to emphasize complete paragraphs of texts we recommend to use
the newly defined Springer class option and environment \verb|svgraybox|.
This will produce a 15 percent screened box 'behind' your text.
\end{svgraybox}

\end{document}

结果非常棒! 在此处输入图片描述

相关内容