固定图片高度(避免与文本重叠)

固定图片高度(避免与文本重叠)

我正在使用picture环境(带有linguex)。但是我的图片与文本重叠:

在此处输入图片描述

我已通过添加一条规则解决了该问题,该规则的宽度和高度为零,相当于图片(30 乘以 0.3ex)加上 1ex(用于额外间隙):\rule[-10ex]{0ex}{10ex}。我怎样才能避免这种手动修复?

在此处输入图片描述


单独的问题:为了使带有上升部和下降部的字符与文本的基线对齐,我将它们粘贴到高度和深度为零的框中:\raisebox{0ex}[0pt][0pt]{$\omega$}。肯定有更简洁的方法吧?


\documentclass[12pt]{article}
\usepackage{lipsum, mathptmx, qtree, linguex}

\begin{document}
\lipsum[1]

\ex.   \setlength\unitlength{.3ex}
\begin{picture}(24,-30)
\multiput(2.5,-1.5)(12,-15){2}{\line(20,-30){6}}
\put(0,0){\makebox(0,0)[t]{\raisebox{0ex}[0pt][0pt]{$\omega$}}}
\put(12,-15){\makebox(0,0)[t]{\raisebox{0ex}[0pt][0pt]{$\pi$}}}
\put(24,-30){\makebox(0,0)[t]{\raisebox{0ex}[0pt][0pt]{$\varphi$}}}
\end{picture}
\rule[-10ex]{0ex}{10ex}

\lipsum[1]
\end{document}

答案1

环境picture采用两组有序对作为参数。第一个是图像尺寸(您需要在 y 值上有一个正数才能产生与 vspace 相同的效果),第二个有序对是图片左下角的坐标。在这个 MWE 中,我使用\begin{picture}(24,33)(0,-30)来实现足够大的尺寸(33)以避免需要\vspace

\documentclass[12pt]{article}
\usepackage{lipsum, mathptmx, qtree, linguex}

\begin{document}
\lipsum[1]

\ex.   \setlength\unitlength{.3ex}
\begin{picture}(24,33)(0,-30)
\multiput(2.5,-1.5)(12,-15){2}{\line(20,-30){6}}
\put(0,0){\makebox(0,0)[t]{\raisebox{0ex}[0pt][0pt]{$\omega$}}}
\put(12,-15){\makebox(0,0)[t]{\raisebox{0ex}[0pt][0pt]{$\pi$}}}
\put(24,-30){\makebox(0,0)[t]{\raisebox{0ex}[0pt][0pt]{$\varphi$}}}
\end{picture}
%\rule[-10ex]{0ex}{10ex}

\lipsum[1]
\end{document}

在此处输入图片描述

要获得 OP 所要求的图顶部的编号,一种方法(最少更改他的代码)是将环境包装picture在包\belowbaseline中的宏中stackengine。图片环境中可能还有其他方法,但我不确定。

\documentclass[12pt]{article}
\usepackage{lipsum, mathptmx, qtree, linguex}
\usepackage{stackengine}
\begin{document}
\lipsum[1]

\ex.   \setlength\unitlength{.3ex}
\belowbaseline[-5pt]{%
\begin{picture}(24,34)(0,-31)
\multiput(2.5,-1.5)(12,-15){2}{\line(20,-30){6}}
\put(0,0){\makebox(0,0)[t]{\raisebox{0ex}[0pt][0pt]{$\omega$}}}
\put(12,-15){\makebox(0,0)[t]{\raisebox{0ex}[0pt][0pt]{$\pi$}}}
\put(24,-30){\makebox(0,0)[t]{\raisebox{0ex}[0pt][0pt]{$\varphi$}}}
\end{picture}%
}

\lipsum[1]
\end{document}

在此处输入图片描述

相关内容