4

I've been working on making a Cards Against Humanity clone in TeX and have everything but this one last bit working. The text on one card is long enough that I need to stick the logo/game name on the same line as the PICK (2) line. I make this work by adding it to the centered boxes with an \hfill. This almost works, except it drops the entire line down below the magin and not aligned with all the other cards. If I remove the tikz circle thingy, it works fine. How can I fix this?

Output: https://drive.google.com/file/d/0B3IwI7ioPGAJTk45RW1lMVBHOTQ/edit?usp=sharing

Code:

\documentclass[parskip]{scrartcl}
\usepackage{xltxtra}
\usepackage[paperwidth=6.9596cm,paperheight=9.4996cm,margin=7.25mm]{geometry}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{xkeyval}
\usepackage{color}

\linespread{1.4}

\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
            \node[shape=circle,draw,fill,inner sep=2pt] (char) {\color{black} #1};}}
\newcommand*{\vcenteredhbox}[1]{\begingroup\setbox0=\hbox{#1}\parbox{\wd0}{\box0}\endgroup}
\newenvironment{bottompar}{\par\vspace*{\fill}}{\clearpage}

\makeatletter
\newcounter{draw}
\newcounter{pick}
\newcounter{small}
\define@key{card}{draw}[0]{\setcounter{draw}{#1}}
\define@key{card}{pick}[0]{\setcounter{pick}{#1}}
\define@key{card}{small}[0]{\setcounter{small}{#1}}
\savekeys{card}{draw, pick, small}
\presetkeys{card}{draw=0, pick=0, small=0}{}
\newcommand*\card[2][]{
\setkeys{card}{#1}
\raggedright
{
    \fontsize{15pt}{1em}\selectfont #2
}
\begin{bottompar}
\ifnum \thesmall>0
\vcenteredhbox{\includegraphics{derpy}}
\vcenteredhbox{
    \fontsize{8.5pt}{1em}\selectfont CAE
}
\hfill
{
\ifnum \thedraw>0
DRAW \circled{\thedraw}\\
\fi
\ifnum \thepick>0
PICK \circled{\thepick}\\
\fi
}
\else
{\raggedleft
\ifnum \thedraw>0
DRAW \circled{\thedraw}\\
\fi
\ifnum \thepick>0
PICK \circled{\thepick}\\
\fi
}
\vcenteredhbox{\includegraphics{derpy}}
\vcenteredhbox{
    \fontsize{8.5pt}{1em}\selectfont Cards Against Equestria
}
\fi
\end{bottompar}
}
\makeatother

\begin{document}
\pagenumbering{gobble}
\setmainfont{HelveticaNeueLTStd-Bd}
\card{Zecora’s meth lab.}
\pagecolor{black}
\color{white}
\card[small=1, pick=2]{Today, Mayor Mare announced her official campaign position on \rule{50mm}{1pt} and \rule{50mm}{1pt}. No pony was the least bit surprised.}
\card{Twilight botched another spell… it’s started raining \rule{50mm}{1pt}.}
\end{document}
2

Removing the newline \\ after each DRAW/PICK command solves the bottom margin issue.

I also changed CAE to CAE\vphantom{q} so that the short form CAE has the same apparent height to \vcenteredhbox as does Cards Against Equestria. This fixes a slight alignment discrepancy I noticed.

\documentclass[parskip]{scrartcl}
\usepackage{xltxtra}
\usepackage[paperwidth=6.9596cm,paperheight=9.4996cm,margin=7.25mm]{geometry}
\usepackage{tikz}
\usepackage{xkeyval}

\linespread{1.4}

\newcommand*\circled[1]{\tikz[baseline=(char.base)]{
            \node[shape=circle,draw,fill,inner sep=2pt,text=black] (char) {#1};}}
\newcommand*{\vcenteredhbox}[1]{\begingroup\setbox0=\hbox{#1}\parbox{\wd0}{\box0}\endgroup}
\newenvironment{bottompar}{\par\vspace*{\fill}}{\clearpage}

\makeatletter
\newcounter{draw}
\newcounter{pick}
\newcounter{small}
\define@key{card}{draw}[0]{\setcounter{draw}{#1}}
\define@key{card}{pick}[0]{\setcounter{pick}{#1}}
\define@key{card}{small}[0]{\setcounter{small}{#1}}
\savekeys{card}{draw, pick, small}
\presetkeys{card}{draw=0, pick=0, small=0}{}
\newcommand*\card[2][]{
\setkeys{card}{#1}
\raggedright
{
    \fontsize{15pt}{1em}\selectfont #2
}
\begin{bottompar}
\ifnum \thesmall>0
\vcenteredhbox{\includegraphics[width=1cm]{example-image-a}}
\vcenteredhbox{
    \fontsize{8.5pt}{1em}\selectfont CAE\vphantom{q}
}
\hfill
{
\ifnum \thedraw>0
DRAW \circled{\thedraw}
\fi
\ifnum \thepick>0
PICK \circled{\thepick}
\fi
}
\else
{\raggedleft
\ifnum \thedraw>0
DRAW \circled{\thedraw}
\fi
\ifnum \thepick>0
PICK \circled{\thepick}
\fi
}
\vcenteredhbox{\includegraphics[width=1cm]{example-image-a}}
\vcenteredhbox{
    \fontsize{8.5pt}{1em}\selectfont Cards Against Equestria
}
\fi
\end{bottompar}
}
\makeatother

\begin{document}
\pagenumbering{gobble}
\setmainfont{HelveticaNeueLTStd-Bd}
\card{Zecora’s meth lab.}
\pagecolor{black}
\color{white}
\card[small=1, pick=2]{Today, Mayor Mare announced her official campaign position on \rule{50mm}{1pt} and \rule{50mm}{1pt}. No pony was the least bit surprised.}
\card{Twilight botched another spell… it’s started raining \rule{50mm}{1pt}.}
\end{document}

enter image description here enter image description here enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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