3

I try to construct a symbol from 4 rules, one horizontal and three vertical ones. \showoutput gives me the correct dimensions for all of them (see below). However, the horizontal one somehow erratically moves slightly to the left or right in the PostScript and PDF. Given four dimensions \@omwd (desired width), \@omht (desired height), \@omhtn (desired height of part above horizontal line), \@omhtp (desired height of part below horizontal line), where \@omht = \@omhtp + \@omhtn; I am using this code:

\documentclass{article}

\title{Testing}
\author{Michael Nüsken}

\begin{document}

\showoutput\fboxsep=0pt

\makeatletter
\newdimen\@omwd 
\newdimen\@omht
\newdimen\@omhtn
\newdimen\@omhtp
\newdimen\@roundlinewidth
\@omwd=3.72299pt
\@omht=7.05666pt
\@omhtn=5.57127pt
\@omhtp=1.48538pt
\@roundlinewidth=0.438pt
%
\def\Y{%
  \vbox to\@omht{\hsize=\@omwd%
    \hbox to\@omwd{%
      \hfil
      \vrule\@width\@roundlinewidth\@height\@omhtn\@depth\z@
      \hfil
    }%
    \kern-.5\@roundlinewidth% overlap vertical and horizontal lines
    \hrule\@width\@omwd\@height\@roundlinewidth\@depth0\@roundlinewidth
    \kern-.5\@roundlinewidth% overlap vertical and horizontal lines
    \hbox to\@omwd{%
      \vrule\@width\@roundlinewidth\@height\@omhtp\@depth\z@
      \hfil
      \vrule\@width\@roundlinewidth\@height\@omhtp\@depth\z@
    }%
  }%
}
\makeatother

Y\Y

\begin{itemize}
\item Y\Y
\end{itemize}

\end{document}

Also I observe that even \fbox does not have rules matching properly in its corners.

For example I obtain:

....\vbox(7.05666+0.0)x3.72299
.....\hbox(5.57127+0.0)x3.72299, glue set 1.6425fil
......\glue 0.0 plus 1.0fil
......\rule(5.57127+0.0)x0.438
......\glue 0.0 plus 1.0fil
.....\kern -0.219
.....\rule(0.438+0.0)x3.72299
.....\kern -0.219
.....\hbox(1.48538+0.0)x3.72299, glue set 2.84698fil
......\rule(1.48538+0.0)x0.438
......\glue 0.0 plus 1.0fil
......\rule(1.48538+0.0)x0.438

But \rule(0.438+0.0)x3.72299 appears to be shifted left or right slightly. However, this does not happen in all positions on a page!???

Is that a bug in TeX? How to fix or bypass that? Please don't tell me it's a rounding problem...

8
  • PS: I am using MikTeX under Windows 7. Oct 31, 2014 at 11:19
  • 1
    It looks good when I compile it, but there are often rendering artifacts with various PDF viewers (i.e., the problem is not in TeX). Oct 31, 2014 at 11:37
  • Incidentally, the same figure can be made with a stack as \documentclass{article} \usepackage{stackengine} \begin{document} \makeatletter \newdimen\@omwd \newdimen\@omht \newdimen\@omhtn \newdimen\@omhtp \newdimen\@roundlinewidth \@omwd=3.72299pt \@omht=7.05666pt \@omhtn=5.57127pt \@omhtp=1.48538pt \@roundlinewidth=0.438pt % \setstackgap{S}{-.5\@roundlinewidth} \setstackEOL{\cr} \Shortstack{ \rule{\@roundlinewidth}{\@omhtn }\cr \rule{\@omwd}{\@roundlinewidth}\cr \rule{\@roundlinewidth}{\@omhtp}\kern\@omwd% \kern-2\@roundlinewidth\rule{\@roundlinewidth}{\@omhtp} } \end{document} Oct 31, 2014 at 11:50
  • please could you fix your example so we can run it as posted and see the problem (at least need catcode of @ but preferably also showing the settings in different positions, so we can confirm whether or not we see the same displacement given identical input Oct 31, 2014 at 12:00
  • Steven: Thanks for your code. However, it has the very same problems. Just it uses higher level commands. Oct 31, 2014 at 14:40

1 Answer 1

4

I'm not getting “erratic” behavior. However, there's a better way for drawing the symbol so that it has the same height as a Y; I set the width to .5em in the current font and the proportion between the two parts as 1:3

\documentclass{article}
\usepackage{amsmath}
\usepackage{pict2e,picture}

\newcommand\drawY{%
  \begingroup
  \dimen0=.5em
  \dimen2=\fontcharht\font`Y
  \dimen4=.25\dimen2
  \begin{picture}(\dimen0,\dimen2)
  \roundcap
  \put(0,0){\line(0,1){\dimen4}}
  \put(\dimen0,0){\line(0,1){\dimen4}}
  \put(0,\dimen4){\line(1,0){\dimen0}}
  \put(.5\dimen0,\dimen4){\line(0,1){\dimexpr\dimen2-\dimen4}}
  \end{picture}%
  \endgroup
}
\newcommand{\Y}{\text{\drawY}}

\begin{document}

{\fboxsep=0pt \fbox{\Y}}

$Y\Y_{Y\Y}$

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .