如何减少文本段落中公式的宽度?
例如:
Paragraphs and new lines it might be desirable to wrap text around a
$(N-1)$-order float (a figure, in our case) so as ... The package may
not come with the $(N-1)$-order default installation of LaTeX. It may
be noted that the width of $(N-1)$-order the image included was
specified relative to.
方程(N-1)太松散,如何处理?
答案1
我可以用
\documentclass[12pt]{article}
\usepackage{times}
\textwidth=.76\textwidth
\begin{document}
Paragraphs and new lines it might be desirable to wrap text
around a $(N-1)$-order float (a figure, in our case) so as ...
The package may not come with the $(N-1)$-order default
installation of LaTeX. It may be noted that the width of
$(N-1)$-order the image included was specified relative to.
\end{document}
这显示了一个明显的错误:数学用的是 Computer Modern,而文本用的是 Times。这些字体在视觉上是不兼容的。如果我改成\usepackage{times}
,\usepackage{mathptmx}
我会得到
结果并不像前一种情况那么“松散”,并且字体是兼容的。
更好的是,使用 NewTX:
\documentclass[12pt]{article}
\usepackage{newtxtext,newtxmath}
\textwidth=.76\textwidth
\begin{document}
Paragraphs and new lines it might be desirable to wrap text
around a $(N-1)$-order float (a figure, in our case) so as ...
The package may not come with the $(N-1)$-order default
installation of LaTeX. It may be noted that the width of
$(N-1)$-order the image included was specified relative to.
\end{document}
但是,您可能希望避免减号周围的空格参与单词间空格的拉伸或收缩以进行对齐,这可以通过添加括号来实现;这也避免了减号后出现换行的风险,就像您的图片中那样。
\documentclass[12pt]{article}
\usepackage{newtxtext,newtxmath}
\textwidth=.76\textwidth
\begin{document}
Paragraphs and new lines it might be desirable to wrap text
around a ${(N-1)}$-order float (a figure, in our case) so as ...
The package may not come with the ${(N-1)}$-order default
installation of LaTeX. It may be noted that the width of
${(N-1)}$-order the image included was specified relative to.
\end{document}
最后的尝试(不太推荐):也减少减号周围的空间,但不要将其删除。
\documentclass[12pt]{article}
\usepackage{newtxtext,newtxmath}
\newcommand{\Nminusone}{$\medmuskip=1mu{(N-1)}$}
\textwidth=.76\textwidth
\begin{document}
Paragraphs and new lines it might be desirable to wrap text
around a \Nminusone-order float (a figure, in our case) so as ...
The package may not come with the \Nminusone-order default
installation of LaTeX. It may be noted that the width of
\Nminusone-order the image included was specified relative to.
\end{document}
答案2
问题表述为改变 N-1 的宽度,但隐含的原因是影响段落中某个特定的换行符。请注意,TeX 对整个段落的换行符进行了最低成本优化,因此更改单个数学表达式可能会改变该点之前和之后段落中的所有换行符,因此很难说一般来说将其加宽或变窄是否会影响该处的换行符。
如果可能的话,最好通过对整个段落进行设置来解决换行问题。在这里,我使用各种设置设置了相同的文本(但有些问题比原来的断行 N-1 更严重 :-)
\documentclass[12pt]{article}
\usepackage{newtxtext,newtxmath,ragged2e}
\textwidth=.76\textwidth
\advance\textheight10\baselineskip
\begin{document}
\newcommand\p{%
Paragraphs and new lines it might be desirable to wrap text
around a $(N-1)$-order float (a figure, in our case) so as ...
The package may not come with the $(N-1)$-order default
installation of LaTeX. It may be noted that the width of
$(N-1)$-order the image included was specified relative to.\par}
\newcommand\sep{\smallskip\hrule\smallskip}
%default
\p
\sep
% try to make one more line
{\looseness=1 \p}
\sep
% try (fail) to make one less line
{\looseness=-1 \p}
\sep
% make one more line without just pushing one word on to the last line
% makes text horribly loose in this case
{\looseness=1 \parfillskip=.5\textwidth\emergencystretch=2cm \p}
\sep
% aggressively tight spacing
{\spaceskip=.1em plus .1em
\medmuskip=2mu minus 2mu
\p}
\sep
% default ragged right
{\raggedright\p}
\sep
% RaggedRight setting which allows less variability in the
% right margin, which causes a generally more even effect
% although not very obvious here.
{\RaggedRight\p}
\end{document}
答案3
graphics
一种方法是使用包和命令缩小方程的宽度\scalebox
。这{.9}
会使其占据通常水平空间的 90%,并[1]
保持垂直高度不变。
代码:
\documentclass{article}
\usepackage{graphics}
\begin{document}
Paragraphs and new lines it might be desirable to wrap text around a
\scalebox{.9}[1]{$(N-1)$}-order float (a figure, in our case) so as ... The package may
not come with the \scalebox{.9}[1]{$(N-1)$}-order default installation of LaTeX. It may
be noted that the width of \scalebox{.9}[1]{$(N-1)$}-order the image included was
specified relative to.
\end{document}
得出:
而不是原来的段落: