我一直在用 TeX 制作 Cards Against Humanity 克隆版,除了最后一点之外,其他一切都正常。一张卡片上的文字足够长,我需要将徽标/游戏名称粘贴在与 PICK (2) 行相同的行上。我通过使用 将其添加到居中框来实现这一点\hfill
。这几乎可以正常工作,只是它会将整行放在 magin 下方,并且不会与所有其他卡片对齐。如果我移除 tikz 圆圈,它就可以正常工作。我该如何修复这个问题?
输出:https://drive.google.com/file/d/0B3IwI7ioPGAJTk45RW1lMVBHOTQ/edit?usp=sharing
代码:
\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}
答案1
\\
删除每个DRAW
/命令后的换行符PICK
可解决底部边距问题。
我还将其更改CAE
为CAE\vphantom{q}
,以便短格式具有与CAE
相同的视高。这修复了我注意到的轻微对齐差异。\vcenteredhbox
Cards Against Equestria
\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}