我尝试适应这些卡片分隔器满足我的需求,但使用 Office 给我带来了很多麻烦。因此,我尝试了 LaTeX,但我不太擅长。我得到了基本的表格,但无法弄清楚如何设置固定高度并正确获取选项卡上的文本和背景图像。如果有人向我展示如何执行类似宏,我将不胜感激
\setlength{cardheight}{5cm}
\setlength{cardwidth}{7cm}
\card{picture.png}{Copper}{Deal 7 Copper cards to each player at start..}.
所需输出的示例:
答案1
请参阅下面的更新。
原始答案
这是 Tikz 解决方案(因为您的问题有一个tikz
标签)。也可以使用表格来完成。滚动的图像拍摄于这里。代码中有一些“神奇数字”(图像的宽度、高度、文本块的宽度、最小高度)。您可以随意修改它们以符合您的喜好。此外,数量(-0.2,0.2)
有点随意,试图使图像接近文本块,因为此特定图像有白色填充。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\newcommand{\leftcard}[5]{ % #1 Background picture, #2 number, #3 number color, #4 Title, #5 text
\begin{tikzpicture}
\node[anchor=south east] (scroll)
{\includegraphics[width=4cm, height=1cm]{#1}};
\node[text width=6cm, draw, anchor=north east, minimum height=4cm]
(text) at ($(scroll.south east)+(-0.2,0.2)$) {\parskip=1ex #5};
\node[circle, fill=#3, anchor=west, draw] (number) at (scroll.west) {#2};
\node (title) at (scroll.center) {#4};
\end{tikzpicture}
}
\newcommand{\rightcard}[5]{ % #1 Background picture, #2 number, #3 number color, #4 Title, #5 text
\begin{tikzpicture}
\node[anchor=south east] (scroll)
{\includegraphics[width=4cm, height=1cm]{#1}};
\node[text width=6cm, draw, anchor=north west, minimum height=4cm]
(text) at ($(scroll.south west)+(0.2,0.2)$) {\parskip=1ex #5};
\node[circle, fill=#3, anchor=west, draw] (number) at (scroll.west) {#2};
\node (title) at (scroll.center) {#4};
\end{tikzpicture}
}
\newcommand{\cards}[5]{
\leftcard{#1}{#2}{#3}{#4}{#5}%
\rightcard{#1}{#2}{#3}{#4}{#5}\par
}
\begin{document}
\cards{scroll.jpg}{0}{orange!80!black}{Copper}{%
Deal 7 Copper cards to each player at the start.
2-4 players, use all basic Treasure cards from one
set.
5-6 players, combine all basic Treasure cards from
two sets.
}
\vskip 1cm
\cards{scroll.jpg}{3}{yellow!80!black}{Silver}{
2-4 players, use all basic Treasure cards from one
set.
5-6 players, combine all basic Treasure cards from
two sets.
}
\end{document}
结果页面:
更新
原帖要求卡片之间不要有间隙,所以我调查了为什么上面的解决方案中会出现间隙。由于回车符的常见问题,出现了一些不必要的空格。%
在关键行的末尾插入一些空格解决了这个问题。
但问题的主要来源是scroll.jpg
我选择使用的图像周围有白色填充,这迫使我“移动”图像以使其更靠近卡片。更好的方法是使用trim
选项删除填充\includegraphics
。这样就不需要移动了。
这是新的解决方案:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\newcommand{\leftcard}[5]{% #1 Background picture, #2 number, #3 number color, #4 Title, #5 text
\begin{tikzpicture}
\node[anchor=south east, inner sep=0pt] (scroll)
{\includegraphics[clip, trim=20 20 20 20, width=4cm, height=1cm]{#1}};
\node[text width=6cm, draw, anchor=north east, minimum height=4cm]
(text) at (scroll.south east) {\parskip=1ex #5};
\node[circle, fill=#3, anchor=west, draw] (number) at (scroll.west) {#2};
\node (title) at (scroll.center) {#4};
\end{tikzpicture}%
}
\newcommand{\rightcard}[5]{% #1 Background picture, #2 number, #3 number color, #4 Title, #5 text
\begin{tikzpicture}
\node[anchor=south west, inner sep=0pt] (scroll)
{\includegraphics[clip, trim=20 20 20 20, width=4cm, height=1cm]{#1}};
\node[text width=6cm, draw, anchor=north west, minimum height=4cm]
(text) at (scroll.south west) {\parskip=1ex #5};
\node[circle, fill=#3, anchor=west, draw] (number) at (scroll.west) {#2};
\node (title) at (scroll.center) {#4};
\end{tikzpicture}%
}
\newcommand{\cards}[5]{
\leftcard{#1}{#2}{#3}{#4}{#5}%
\rightcard{#1}{#2}{#3}{#4}{#5}\par
}
\begin{document}
\cards{scroll.jpg}{0}{orange!80!black}{Copper}{%
Deal 7 Copper cards to each player at the start.
2-4 players, use all basic Treasure cards from one
set.
5-6 players, combine all basic Treasure cards from
two sets.
}
\vskip 1cm
\cards{scroll.jpg}{3}{yellow!80!black}{Silver}{
2-4 players, use all basic Treasure cards from one
set.
5-6 players, combine all basic Treasure cards from
two sets.
}
\end{document}
答案2
这是一个不使用 TikZ 的解决方案,使用了一些简单的minipage
s、\parbox
es 和tabular
s(使用的测试图像与杰利迪亚兹的答案):
\documentclass{article}
\usepackage[margin=2cm,paperheight=16cm]{geometry}
\usepackage{graphicx}
\newlength\cardheight
\newlength\cardwidth
\setlength\cardheight{5cm}
\setlength\cardwidth{7cm}
\newcommand\cards[4]{%
\par\noindent
\begin{minipage}{\cardwidth}
\raggedleft\includegraphics[width=.5\cardwidth,height=1cm]{#1}%
\llap{\raisebox{0.4cm}{\parbox[t]{.5\linewidth}{\centering\bfseries#2}}}
\end{minipage}%
\begin{minipage}{\cardwidth}
\raggedright\includegraphics[width=.5\cardwidth,height=1cm]{#1}
\llap{\raisebox{0.4cm}{\parbox[t]{.5\linewidth}{\centering\bfseries#2}}}
\end{minipage}\par\nobreak\nointerlineskip
\noindent\fbox{\begin{minipage}[t][\cardheight][t]{\dimexpr\cardwidth-2\fboxsep-2\fboxrule\relax}
\renewcommand\arraystretch{1.3}
\begin{tabular}{p{\dimexpr\linewidth-2\tabcolsep\relax}}
\hfill \small\scshape #3 \\
#4
\end{tabular}
\end{minipage}}%
\fbox{\begin{minipage}[t][\cardheight][t]{\dimexpr\cardwidth-2\fboxsep-2\fboxrule\relax}
\renewcommand\arraystretch{1.3}
\begin{tabular}{p{\dimexpr\linewidth-2\tabcolsep\relax}}
\small\scshape #3 \\
#4
\end{tabular}%
\end{minipage}}\par\bigskip%
}
\pagestyle{empty}
\begin{document}
\centering
\cards{scroll}{Copper}{Treasure ($\times 30$)}{%
Deal 7 Copper cards to each player at the start. \\
2-4 players, use all basic Treasure cards from oneset. \\
5-6 players, combine all basic Treasure cards from two sets.}
\setlength\cardheight{4cm}
\setlength\cardwidth{8cm}
\cards{scroll}{Silver}{Treasure ($\times 40$)}{%
Deal 7 Copper cards to each player at the start. \\
2-4 players, use all basic Treasure cards from oneset. \\
5-6 players, combine all basic Treasure cards from two sets.}
\end{document}