2

I have a problem with the flacards package. I'm trying to make playing cards, where the frame of different cards are colored differently. Here is a working example:

\documentclass[a4paper,frontgrid]{flacards}
\usepackage{aurical}
\usepackage[T1]{fontenc}
\usepackage{ngerman}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,backgrounds,shadows,decorations.pathmorphing,calc,shapes.geometric,patterns}
\usepackage{graphicx}

\usepackage{color}
\usepackage{transparent}
\fboxsep=0mm

\renewcommand{\frfoot}{\footnotesize\thecardno\hskip3pt\smallskip} % change layout for left foot on front
\renewcommand{\brfoot}{}

%Group Colors

\definecolor{griff}{RGB}{224, 57, 35}
\definecolor{slyth}{RGB}{45, 205, 109}

%Command for Card Title:
\renewcommand{\fchead}[1]{\textbf{\Huge{#1}}}

%BACKGROUND

\renewcommand{\flhead}[1]{\texttransparent{0.4} %Background Transparency
{\begin{tikzpicture}[remember picture, overlay]
\node  at (3.18,-4.64) {
   \includegraphics[width=63.47mm, height=92.477mm]{pics/parch4.jpg}
};%
\end{tikzpicture}}
{\begin{tikzpicture}[remember picture, overlay]
\fill[{black}, even odd rule]

(-0.138,-9.24) rectangle ++(63.47mm,92.477mm)
(-0.138 + 0.175,-9.24+0.175) rectangle ++(60mm,89mm);
\end{tikzpicture}}
}

\begin{document}

\Fontskrivan
\pagesetup{3}{3} % 3x3 cards

\card{
\fchead{Test}\\
Test}{Empty}

\end{document}

Now, If I renew the command \flhead to make it dependent to a variable #1, it seems not to work, since the predefined macro \card prints the \flhead command anyway.

   \renewcommand{\flhead}[1]{\texttransparent{0.4} %Background Transparency
    {\begin{tikzpicture}[remember picture, overlay]
    \node  at (3.18,-4.64) {
       \includegraphics[width=63.47mm, height=92.477mm]{pics/parch4.jpg}
    };%
\end{tikzpicture}}
   {\begin{tikzpicture}[remember picture, overlay]
\fill[{#1}, even odd rule]

(-0.138,-9.24) rectangle ++(63.47mm,92.477mm)
(-0.138 + 0.175,-9.24+0.175) rectangle ++(60mm,89mm);
\end{tikzpicture}}

The command \flhead works, but only alone. Within the \card macro it does not work.

\card{
\flhead{black}
 \fchead{Test}\\
Test}{test}

Why this doesn't work? Any idea how it could work? This is for a present for my little brother and I want to finish this in the next 10 days.

P.S.: If you wonder why I made the frame in such a complicated way, I later want to apply some structure to the inner rectangle. (But this would be a new question)

1

Here I set up a macro \myflhead, that redefines \flhead with the given color argument. I think the issue is that, perhaps, \flhead is not intended, itself, to take arguments.

Still, \myflhead needs to be invoked prior to the invocation of \card, but can be used to change the border color.

\documentclass[a4paper,frontgrid]{flacards}
\usepackage{aurical}
\usepackage[T1]{fontenc}
\usepackage{ngerman}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,backgrounds,shadows,decorations.pathmorphing,calc,shapes.geometric,patterns}
\usepackage{graphicx}

\usepackage{color}
\usepackage{transparent}
\fboxsep=0mm


\renewcommand{\frfoot}{\footnotesize\thecardno\hskip3pt\smallskip} % change layout for left foot on front
\renewcommand{\brfoot}{}



%Group Colors

\definecolor{griff}{RGB}{224, 57, 35}
\definecolor{slyth}{RGB}{45, 205, 109}


%Command for Card Title:
\renewcommand{\fchead}[1]{\textbf{\Huge{#1}}}


%BACKGROUND

\newcommand\myflhead[1]{%
\renewcommand{\flhead}{\texttransparent{0.4} %Background Transparency
{\begin{tikzpicture}[remember picture, overlay]
\node  at (3.18,-4.64) {
   \includegraphics[width=63.47mm, height=92.477mm]{example-image}
};%
\end{tikzpicture}}
{\begin{tikzpicture}[remember picture, overlay]
\fill[{#1}, even odd rule]

(-0.138,-9.24) rectangle ++(63.47mm,92.477mm)
(-0.138 + 0.175,-9.24+0.175) rectangle ++(60mm,89mm);
\end{tikzpicture}}
}
}
\begin{document}

\Fontskrivan
\pagesetup{3}{3} % 3x3 cards

\myflhead{red}
\card{
\fchead{Test}\\
Test}{Empty}

\myflhead{green}
\card{
\fchead{Test}\\
Test}{Empty}

\end{document}

enter image description here

Alternately, to achieve the same result, \card could be redefined to take the border color as an optional argument, as in

\card[red]{
\fchead{Test}\\
Test}{Empty}

Here is the MWE.

\documentclass[a4paper,frontgrid]{flacards}
\usepackage{aurical}
\usepackage[T1]{fontenc}
\usepackage{ngerman}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,backgrounds,shadows,decorations.pathmorphing,calc,shapes.geometric,patterns}
\usepackage{graphicx}

\usepackage{color}
\usepackage{transparent}
\fboxsep=0mm


\renewcommand{\frfoot}{\footnotesize\thecardno\hskip3pt\smallskip} % change layout for left foot on front
\renewcommand{\brfoot}{}



%Group Colors

\definecolor{griff}{RGB}{224, 57, 35}
\definecolor{slyth}{RGB}{45, 205, 109}


%Command for Card Title:
\renewcommand{\fchead}[1]{\textbf{\Huge{#1}}}


%BACKGROUND

\newcommand\myflhead[1]{%
\renewcommand{\flhead}{\texttransparent{0.4} %Background Transparency
{\begin{tikzpicture}[remember picture, overlay]
\node  at (3.18,-4.64) {
   \includegraphics[width=63.47mm, height=92.477mm]{example-image}
};%
\end{tikzpicture}}
{\begin{tikzpicture}[remember picture, overlay]
\fill[{#1}, even odd rule]

(-0.138,-9.24) rectangle ++(63.47mm,92.477mm)
(-0.138 + 0.175,-9.24+0.175) rectangle ++(60mm,89mm);
\end{tikzpicture}}
}
}

\let\svcard\card
\renewcommand\card[2][black]{\myflhead{#1}\svcard{#2}}
\begin{document}

\Fontskrivan
\pagesetup{3}{3} % 3x3 cards

\card[red]{
\fchead{Test}\\
Test}{Empty}

\card[green]{
\fchead{Test}\\
Test}{Empty}

\end{document}

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.