![Ложный перенос пробелов отображает математику в \small](https://rvso.com/image/328820/%D0%9B%D0%BE%D0%B6%D0%BD%D1%8B%D0%B9%20%D0%BF%D0%B5%D1%80%D0%B5%D0%BD%D0%BE%D1%81%20%D0%BF%D1%80%D0%BE%D0%B1%D0%B5%D0%BB%D0%BE%D0%B2%20%D0%BE%D1%82%D0%BE%D0%B1%D1%80%D0%B0%D0%B6%D0%B0%D0%B5%D1%82%20%D0%BC%D0%B0%D1%82%D0%B5%D0%BC%D0%B0%D1%82%D0%B8%D0%BA%D1%83%20%D0%B2%20%5Csmall.png)
Я могу поместить display math в середину абзаца текста с помощью \[...\]
, но я бы хотел, чтобы математика использовала размер шрифта small
. Если я оберну display block во {\small...}
вторую половину абзаца, начиная со слова "centuries", начнется с небольшого количества нежелательных пробелов. Это исчезнет, если я удалю {\small...}
.
\documentclass{article}
\begin{document}
Lorem Ipsum is simply dummy text of the printing and typesetting
industry. Lorem Ipsum has been the industry's standard dummy text ever
since the 1500s, when an unknown printer took a galley of type and
scrambled it to make a type specimen book. It has survived not only five
{\small\[
A / B + C = D
\]}
centuries, but also the leap into electronic typesetting, remaining
essentially unchanged. It was popularised in the 1960s with the release
of Letraset sheets containing Lorem Ipsum passages, and more recently
with desktop publishing software like Aldus PageMaker including versions
of Lorem Ipsum.
\end{document}
Думаю, я неправильно подхожу к этому вопросу. Помогите?
решение1
Вы получаетедваложные пробелы: один в начале строки, что более заметно, а также более тесное вертикальное пространство над дисплеем, чем под ним, поскольку вы используете верхний пропуск, относящийся к \small
, но нижний пропуск, относящийся к \normalsize
.
Вы можете эмулировать стандартное поведение:
\documentclass{article}
\begin{document}
Lorem Ipsum is simply dummy text of the printing and typesetting
industry. Lorem Ipsum has been the industry's standard dummy text ever
since the 1500s, when an unknown printer took a galley of type and
scrambled it to make a type specimen book. It has survived not only five
{\par\penalty\predisplaypenalty\small\[
A / B + C = D
\]\par}\penalty\postdisplaypenalty\noindent
centuries, but also the leap into electronic typesetting, remaining
essentially unchanged. It was popularised in the 1960s with the release
of Letraset sheets containing Lorem Ipsum passages, and more recently
with desktop publishing software like Aldus PageMaker including versions
of Lorem Ipsum.
\end{document}
Вы можете определить vardisplaymath
среду:
\makeatletter
\newenvironment{vardisplaymath}[1][\small]
{\par\penalty\predisplaypenalty\begingroup#1\begin{displaymath}}
{\end{displaymath}\par\endgroup\penalty\postdisplaypenalty
\@endparenv}
\makeatletter
Полный пример:
\documentclass{article}
\makeatletter
\newenvironment{vardisplaymath}[1][\small]
{\par\penalty\predisplaypenalty\begingroup#1\begin{displaymath}}
{\end{displaymath}\par\endgroup\penalty\postdisplaypenalty
\@endparenv}
\makeatletter
\begin{document}
Lorem Ipsum is simply dummy text of the printing and typesetting
industry. Lorem Ipsum has been the industry's standard dummy text ever
since the 1500s, when an unknown printer took a galley of type and
scrambled it to make a type specimen book. It has survived not only five
\begin{vardisplaymath}
A / B + C = D
\end{vardisplaymath}
centuries, but also the leap into electronic typesetting, remaining
essentially unchanged. It was popularised in the 1960s with the release
of Letraset sheets containing Lorem Ipsum passages, and more recently
with desktop publishing software like Aldus PageMaker including versions
of Lorem Ipsum.
\begin{vardisplaymath}[\footnotesize]
A / B + C = D
\end{vardisplaymath}
centuries, but also the leap into electronic typesetting, remaining
essentially unchanged. It was popularised in the 1960s with the release
of Letraset sheets containing Lorem Ipsum passages, and more recently
with desktop publishing software like Aldus PageMaker including versions
of Lorem Ipsum.
\end{document}
Это можно настроить так, чтобы всегда получать параметры из \normalsize
.
Спасибо Тоби за предложение по улучшению.
Более простой подход, не требующий погружения в детали, такие как \penalty\postdisplaypenalty
(необходимые для того, чтобы избежать разрывов страниц после отображения) и сохранения пропусков выше и ниже, заключается в следующем \normalsize
:
\newsavebox{\vardisplaymathbox}
\newenvironment{vardisplaymath}[1][\small]
{\begin{displaymath}\begin{lrbox}{\vardisplaymathbox}
#1$\displaystyle}
{$\end{lrbox}\usebox{\vardisplaymathbox}\end{displaymath}%
\ignorespacesafterend}
Результат этого определения: