这是我得到的\textbar
:
我想要的效果如下:
答案1
用一个\rule
\documentclass{article}
\newcommand{\lpipe}{\rule[-0.4ex]{0.41pt}{2.3ex}}
\begin{document}
Wintersemester 2011 \lpipe\ 2012
\end{document}
可选参数采用垂直提升,第一个强制参数采用线宽,第二个参数采用高度。您可以调整值以满足您的需求(和字体设置)
更新
\documentclass{article}
\newcommand{\lpipe}{\smash{\rule[-0.4ex]{0.41pt}{42ex}}}
\begin{document}
Some text to fill the lines and see the \verb+\baselineskip+ increasing.
Now let's type the \lpipe\ pipe. And some more filler text. And some more
filler text. And some more filler text. And some more filler text. More
filler text. And some more filler text. And some more filler text. More
filler text. And some more filler text. And some more filler text.
\bigskip
H\lpipe H\\
H \lpipe\ H
\end{document}
更新 2
我添加了\smash
的定义\lpipe
以使其不影响行高。但我认为行高应该尽可能高,而不会增加行高(即使没有\smash
)。否则它很难适合使用的字体。
为了说明这一点,我拍了这张照片
这是此代码的结果
\documentclass{article}
\newcommand{\lpipe}{\rule[-0.4ex]{0.41pt}{2.3ex}}
\newcommand{\badlpipe}{\smash{\rule[-0.4ex]{0.41pt}{3.2ex}}}
\begin{document}
Some text to fill the lines and see the \verb+\baselineskip+ increasing.
Now let's type the \lpipe\ pipe. And some more filler text. And some more
filler text. And some more filler text. And some more filler text. More
filler text. And some more filler text. And some more filler text. More
filler text. And \badlpipe\ some more filler text. And some more filler text.
\end{document}
有点\badlpipe
太长了,不影响行高,所以我用了\smash
。但很容易看出,这种风格很糟糕,看起来也不好看……
答案2
以下是另一种选择:
\documentclass{standalone}
\begin{document}
Wintersemester 2012 $\mid$ 2013
\end{document}