0

I am having an issue implementing the \pgfkeys command for a marco I want to compile. Here is the code. Please let me know what went wrong:

  \documentclass{article}
    \usepackage{graphicx} 
    \usepackage{graphicx}
    \usepackage{xcolor}
    \usepackage{pgfkeys}
 
     %Dictionaries
    \pgfkeys{%
        /attention/.is family, /attention,
        %Here are the defaults
default/.style = {
         text size = \large,
         text style = \bfseries,
         text colour = green,
    },
    %store the defaults in a command

    text size/.store in =\txtsize,
    text style/.store in = \txtstyle,
    text colour/.store in =\txtcolour,
}%
%Macro
\newcommand{\attention}[2][]{%
\pgfkeys{/attention, default, #1}
{\txtsize\txtstyle\textcolor{\txtcolour}{#2}}
}%

\title{}


\begin{document}

\maketitle

So we are...\attention{Let's get this macro started}... shall we? 


\end{document}
0

1 Answer 1

2

Remove the blank line in \pgfkeys...

\documentclass{article}
\usepackage{graphicx} 
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{pgfkeys}

% Dictionaries
\pgfkeys{%
  /attention/.is family,
  /attention,
  % Here are the defaults
  default/.style = {
    text size = \large,
    text style = \bfseries,
    text colour = green,
  },
  % store the defaults in a command
  text size/.store in =\txtsize,
  text style/.store in = \txtstyle,
  text colour/.store in =\txtcolour,
}

% Macro
\newcommand{\attention}[2][]{%
  \pgfkeys{/attention, default, #1}%
  {\txtsize\txtstyle\textcolor{\txtcolour}{#2}}%
}

\title{}


\begin{document}

\maketitle

So we are...\attention{Let's get this macro started}... shall we? 


\end{document}

You must log in to answer this question.

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