Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm trying to make cards for a game.

I have a problem with \parbox. It's working ok only if the \parbox in the previous picture is empty. If it's not the contents of \parbox are shifted down.

Here is the code and output it makes. Cards go right to left because the ticket package goes top to bottom and I rotated the whole page so the contents of cards are upright.

Why does that happen?

output

\documentclass[a4paper,12pt]{article}
\usepackage[cutmark]{ticket}
\usepackage{pstricks}
\usepackage{fp}

\hoffset=-5.0mm
\voffset=-20.0mm

\unitlength=1mm
\ticketNumbers{2}{5}
\ticketSize{85}{55}
\ticketDistance{0}{0}

\newcommand{\pbox}[3]{\parbox{#1}{\center\fontsize{#2}{#2}\selectfont#3}}

\renewcommand{\ticketdefault}{}

\newcommand{\myticket}[1]{\ticket{%
\pspicture[unit=10mm](0,0)(5.5,8,5)%
\rput[bl]{90}(8.5,0){%
  \rput[t](2.75,8){\pbox{4cm}{25}{#1}}%
  \psgrid[gridlabels=0,unit=.5,subgriddiv=0,gridwidth=0.1pt](0,0)(11,17)%
}\endpspicture%
}}

\begin{document}
\myticket{}
\myticket{1}
\myticket{2}
\myticket{}
\myticket{3}
\myticket{}
\myticket{}
\myticket{4}
\myticket{5}
\myticket{6}
\end{document}
share|improve this question
    
Note that \center is the start of the {center} environment and therefore should be followed by \endcenter. You confusing it with \centering I assume. –  Martin Scharrer Feb 13 '11 at 13:55
add comment

1 Answer

up vote 2 down vote accepted

try it this way:

\newcommand\pbox[3]{\parbox{#1}{\centerline{\fontsize{#2}{#2}\selectfont#3}}}

or alternetively:

\newcommand\pbox[3]{\makebox[#1]{\fontsize{#2}{#2}\selectfont#3}}
share|improve this answer
    
Thanks, both work fine. I forgot to ask why it does happen? –  Domin Feb 13 '11 at 13:55
    
Your \center starts a paragraph with some additional space –  Herbert Feb 13 '11 at 13:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.