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 creating cards for a card game. They will be similar to cards in Magic: The Gathering (left-hand image below). What I have is in the right-hand image below.

fireball fury

The problem is that the code doesn't generate the image in a modifiable/maintainable way, in the following respect. The image essentially consists of four juxtaposed blocks of varying shapes ('Fury', the white square, 'Persistent' and the final text square). There is then a red border (as it happens, with a drop shadow) drawn around these blocks and along the boundaries between them. At the moment I am manually specifying the path of the border.

Now, I want to be able to change the number and position of the various blocks (for different types of cards) and have the border automatically adapt. It seems that it might be possible to do this by taking the union of the blocks, and 'expanding' it a little to form a red object which sits behind the blocks. So something like a drop shadow operation, but more complex. (Then that red object would itself need a drop shadow.)

Is this feasible?

NB. Any other visual improvements would be gratefully received!

Edit: I've realised that drawing the 4 boxes with thick red lines at the borders might have the desired effect. Or more exactly, I need the following in order:

  1. the drop shadows (thickened lines, black, translated) and (thickened lines, white, translated)
  2. the border (thickened lines, red)
  3. the original material.

A key problem is that applying 1,2,3 for the first block, then the second, etc. will fail -- all step 1s need to happen before all step 2s, and so on.

Is it possible to make a style that does this?




\cs_new_eq:NN \Repeat \prg_replicate:nn






\begin{tikzpicture}[baseline = (text.base)]
  \node[inner sep=0pt] (text) {#2};
    \node[fit=(text), rounded corners, fill=#1, draw=none] {};

\tikzset{path image/.style={
path picture={
\node at (path picture bounding box.center) {

\tikzset{double shadow/.style={
drop shadow={shadow xshift=-0.5mm,shadow yshift=-0.5mm,black},
preaction={drop shadow={shadow xshift=0.3mm,shadow yshift=0.3mm,white!70!black}}

    \fill[black,rounded corners=\rounding] (0,0) rectangle (\cardwidth,\cardheight); 

    %\draw[path image=texture_#1.png,rounded corners=1mm] (\rounding,\rounding) rectangle (\cardwidth-\rounding,\cardheight-\rounding);

    \fill[#1!75!black, %Draw red frame
          double shadow]
         -- (\backgroundthickness,\attbarbottom) 
         to[bend left] (\backgroundthickness,\attbartop) 
         -- (\backgroundthickness,\topbarbottom) 
         to[bend left] (\backgroundthickness,\cardheight-\backgroundthickness) 
         -- (\cardwidth-\backgroundthickness,\cardheight-\backgroundthickness) 
         to[bend left] (\cardwidth-\backgroundthickness,\topbarbottom) 
         -- (\cardwidth-\backgroundthickness,\attbartop) 
         to[bend left] (\cardwidth-\backgroundthickness,\attbarbottom) 
         -- (\cardwidth-\backgroundthickness,\backgroundthickness) 
         -- cycle;

    \fill[#1!10,drop shadow={shadow xshift=-0.2mm,shadow yshift=0.3mm,black}] %Draw text box
        (\backgroundthickness+\framethickness,\backgroundthickness+\framethickness) rectangle 

    \draw[black,thick,fill=#1!40] %Draw center bar
         to[bend left] (\backgroundthickness+\framethickness,\attbartop-\framethickness) 
         -- (\cardwidth-\backgroundthickness-\framethickness,\attbartop-\framethickness) 
         to[bend left] (\cardwidth-\backgroundthickness-\framethickness,\attbarbottom+\framethickness) 
         -- cycle;

    \draw[black,thick,fill=white] %Draw Image placeholder
        (\backgroundthickness+\framethickness,\attbartop) rectangle 

    \draw[black,thick,fill=#1!40] %Draw top bar
         to[bend left] (\backgroundthickness+\framethickness,\cardheight-\backgroundthickness-\framethickness) 
         -- (\cardwidth-\backgroundthickness-\framethickness,\cardheight-\backgroundthickness-\framethickness) 
         to[bend left] (\cardwidth-\backgroundthickness-\framethickness,\topbarbottom+\framethickness) 
         -- cycle;

    \node[anchor=south west] at (\backgroundthickness,\topbarbottom+1mm) {\raisebox{0pt}[\height][0pt]{\bf #2}};
    \node[anchor=east] at (\cardwidth-\backgroundthickness-\framethickness+0.5mm,\topbarbottom+3.5mm) {\raisebox{0pt}[\height][0pt]{\bf #3}};
    \node[anchor=south west] at (\backgroundthickness,\attbarbottom+1mm) {\raisebox{0pt}[\height][0pt]{#5}};    

    \node[anchor=north west,text width=\cardwidth-2*\backgroundthickness-2*\framethickness-2mm,font=\footnotesize] at (\backgroundthickness+\framethickness,\attbarbottom-0.5mm) {#6};

    \node[anchor=south east,font=\tiny] at (\cardwidth-\backgroundthickness-\framethickness,\backgroundthickness+\framethickness) {\raisebox{0pt}[\height][0pt]{\bf Tier #7}};


    \node[fill=#1!75!black,shape=circle,inner sep=0.3mm,draw=black,text=white,text width={}] (TEXT) {\raisebox{0pt}[\height][0pt]{\bf #2}};

    \node[fill=#1!75!black,shape=circle,inner sep=0.3mm,draw=black,text=white,text width={}] (TEXT) {\raisebox{0pt}[\height][0pt]{\bf #2}};

\card{red}{Fury}{\cost{red}{1}}{}{Persistent}{You gain a \textbf{Bonus} of 1 to all melee attack rolls.\\\  \\Effect ends when a double is rolled on a melee attack.\\\  \\\textit{Bonuses do not stack.}}{1}


(I've commented out a line that uses a red texture, but just in case: it's here and must be renamed to texture_red.png.)

share|improve this question
Not that this is a bad question to ask, but in practice, why not use Magic Set Editor? Despite the name I believe it can work with customized templates for other card games. –  David Z Jun 19 at 1:31
You should have a look at this answer, which explains how to draw shadows on different layers. –  TonioElGringo Jun 24 at 13:44

Your Answer


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

Browse other questions tagged or ask your own question.