2

Consider the following code:

\documentclass{book}
\usepackage{tikz}
\usepackage{xcolor}
\usepackage{pgothic}

\newcommand\titleshading[3]{
    \newcommand\xoffset{0.3}
    \newcommand\yoffset{-0.25}
    % Blur
    \foreach \x in {-0.1,0.1} {
        \foreach \y in {-0.1,0.1} {         
            \node[red!30] at (#1em+\xoffset em+\x em,#2em+\yoffset em+\y em) {
                \scalebox{3.25}{\Huge\pgothfamily{#3}} 
            };
        }
    }

    % Main Shadow
    \node[red!30] at (#1em+0.3em,#2em-0.2em) {
        \scalebox{3.25}{\Huge\pgothfamily{#3}} 
    };
    \node at (#1em,#2em) {
        \scalebox{3.25}{\Huge\pgothfamily{#3}} 
    };
}

\begin{document}
\begin{tikzpicture}[remember picture,overlay]   
    \titleshading{18}{0}{Ye Olde English} \vspace*{35pt}
%        \titleshading{18}{0}{Steak \& Kidney Pies}
\end{tikzpicture} 
\end{document}

which produces the output:

enter image description here

I would like to be able to finish off the title by adding, say, "Steak & Kidney Pies" underneath it.

However, when I uncomment % \titleshading{18}{0}{Steak \& Kidney Pies} in the code and run it---I get an error.

Furthermore, I thought of making one long title: "Ye Olde English Steak & Kidney Pies" and have LaTeX determine where to start a new line---it didn't; neither does \linebreak nor \\ work in this tikzpicture envirnoment.

Alas, I thought, perhaps, that I would create a \newcommand instead of \titleshading, say, \titleshading1---but this was not allowed.

QUESTION: (i) How may I finish off the above title so that "Steak & Kidney Pies" is centered below "Ye Olde English"? (ii) How may I create other title shading commands for other titles in the document that may have different fonts, and scalings, and shadings (such as "Ye Olde Stratford-upon-Avon On-the-Street Fish & Chips" with a Cabin font, all nodes scaled 2.5, and with the previous color shadings)?

Thank you.

1
  • 1
    \titleshading1 cannot work since the macro name may not contain digits, but \titleshadingA could. Feb 4, 2022 at 17:26

1 Answer 1

3

Question #1. Add a vertical offset that increases the same amount on each pass. (yoffsetplus)

b

Question #2. A new command \titleshadingx similar to \titleshading using another font and scaling. The shadows was slightly corrected.

c

This is the full code.

    % !TeX TS-program = pdflatex    
    
    \documentclass[oneside]{book}
    \usepackage{tikz}
    \usepackage{xcolor}
    \usepackage{pgothic}    
    \usepackage[T1]{fontenc}
    
    \newcommand\xoffset{0.3}
    \newcommand\yoffset{-0.25}

    \newcounter{yoffsetplus}% added <<<<<<<<<<<<<<<<
    \setcounter{yoffsetplus}{0}
    \newcounter{yoffsetplusx}% added <<<<<<<<<<<<<<<<
    \setcounter{yoffsetplusx}{0}
    
    
    \newcommand\titleshading[3]{%
        % Blur
        \foreach \x in {-0.1,0.1} {%
            \foreach \y in {-0.1,0.1} { %     
                \node[red!30] at (#1em+\xoffset em+\x em,#2em+\yoffset em+\y em+\theyoffsetplus) {% changed <<<
                    \scalebox{3.25}{\Huge\pgothfamily{#3}} 
                };
            }
        }
        
        % Main Shadow
        \node[red!30] at (#1em+0.3em,#2em-0.2em+\theyoffsetplus) {
            \scalebox{3.25}{\Huge\pgothfamily{#3}} 
        };
        \node at (#1em,#2em+\theyoffsetplus) {
            \scalebox{3.25}{\Huge\pgothfamily{#3}} 
        };
    \addtocounter{yoffsetplus}{-120} % added <<<<<<<<<<<<<<<<<<<<<<
    }


\newcommand\titleshadingx[3]{% added <<<<<<<<<<<<<<<<<<<<
    % Blur
    \foreach \x in {-0.1,0.1} {%
        \foreach \y in {-0.1,0.1} {%         
            \node[red!30] at (#1em+\xoffset em+\x em,#2em+\yoffset em+\y em+\theyoffsetplusx) {% 
                \scalebox{2.5}{\fontfamily{Cabin-TLF}\fontsize{18}{20}\selectfont #3} 
            };
        }
    }
    
    % Main Shadow
    \node[red!30] at (#1em+0.3em,#2em-0.2em+\theyoffsetplusx) {%
        \scalebox{2.5}{\fontfamily{Cabin-TLF}\fontsize{18}{20}\selectfont #3} 
    };
    \node at (#1em+0.2em,#2em-0.2em+\theyoffsetplusx) {%
        \scalebox{2.5}{\fontfamily{Cabin-TLF}\fontsize{18}{20}\selectfont #3} 
    };
    \addtocounter{yoffsetplusx}{-80} % added <<<<<<<<<<<<<<<<<<<<<<
}

    
    \begin{document}
        \pagestyle{empty}\parindent0pt
        
    \begin{tikzpicture}[remember picture,overlay]   
                \titleshading{18}{0}{Ye Olde English} 
                \titleshading{18}{0}{Steak \& Kidney Pies}
                \titleshading{18}{0}{Beer \& Wine}
        \end{tikzpicture} 
    
    \clearpage
    
    \begin{tikzpicture}[remember picture,overlay]   
        \titleshadingx{18}{0}{Ye Olde Stratford-upon-Avon} 
        \titleshadingx{18}{0}{On-the-Street Fish \& Chips}
        \titleshadingx{18}{0}{Beer \& Wine}
    \end{tikzpicture} 
    
    \end{document}

Option

Commenting out \addtocounter{yoffsetplusx}{-80}

    %\addtocounter{yoffsetplusx}{-80} % added <<<<<<<<<<<<<<<<<<<<<<

The vertical spacing can be controlled one by one using the second parameter (em units).

    \begin{tikzpicture}[remember picture,overlay]   
        \titleshadingx{18}{0}{Ye Olde Stratford-upon-Avon} 
        \titleshadingx{18}{-8}{On-the-Street Fish \& Chips}
        \titleshadingx{18}{-20}{Beer \& Wine}
    \end{tikzpicture} 
    

d

3
  • Thank you kindly for your answer to this question. Feb 4, 2022 at 18:18
  • (Though I don't recall Beer & Wine being sold on the street with the fish & chips in Stratford) :) Thanks again. Feb 4, 2022 at 18:20
  • @mlchristians maybe now because of the pandemic ... Feb 4, 2022 at 18:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .