1

I am writing my thesis and I would like to define the command \dedicationpage in my class.

I have done the following in my .cls file.

\newcommand\dedicationpage[1][]{
\ifthenelse{\isempty{#1}}{
    \cleardoublepage
    \thispagestyle{empty}
    \null
    \cleardoublepage
}{
    \cleardoublepage
    \thispagestyle{empty}
    \null
    \vspace{\stretch{1}}
    %
    \begin{flushright}
        \emph{#1}
    \end{flushright}
    %
    \vspace{\stretch{3}}
    \null
    %
    \cleardoublepage
    }%
}

However, in my tex file I write

\dedicationpage{To Martino,\\
            for the hope. \\
            To Gabri and Betta, \\
            for the bravery.}

and what I get is the image I attach. enter image description here

which is not right aligned nor emphasised.

3
  • I'd use \itshape within you local definition.
    – Sigur
    Feb 1, 2018 at 17:09
  • Thanks. It works to make it italic, but still I don't understand why latex doesn't see the \emph{} command nor the \flushright one
    – Oscar
    Feb 1, 2018 at 17:12
  • 2
    You're defining \dedicationpage with an optional argument, but use it with braces: \dedicationpage[To Martino,...]
    – egreg
    Feb 1, 2018 at 17:19

1 Answer 1

2

There seems to be no (good?!) reason for making the single argument of \dedicationpage optional. If you change the line

\newcommand\dedicationpage[1][]{

to

\newcommand\dedicationpage[1]{%

i.e., if you make the argument mandatory, you can then write

\dedicationpage{To Martino,\\
            for the hope. \\
            To Gabri and Betta, \\
            for the bravery.}

and get exactly what you'd expect. If you want the dedication page to be blank, just write \dedicationpage{} or \dedicationpage{\null}.

Alternatively, if for some reason you wish to keep the optional-argument setup, just accept @egreg's advice and write

\dedicationpage[To Martino,\\
            for the hope. \\
            To Gabri and Betta, \\
            for the bravery.]

i.e., encase the argument in square brackets, not curly braces.

You must log in to answer this question.

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