About
Shop
LaTeX
Software
Books
Gallery
News
Contact
Blog
Settings
Account
Latest news 2024-07-03: Ebook sale (1st – 31st July 2024): short story cybercrime fiction Unsocial Media free; short story cybercrime fiction Smile for the Camera free; short story noir crime fiction I’ve Heard the Mermaid Sing free; crime fiction novel The Private Enemy US$1.99; illustrated children’s story The Foolish Hedgehog US$0.99.

Exercise 20: Defining Commands with an Optional Argument (Solution)

This is the solution to Exercise 20.
\documentclass[11pt]{scrartcl}

\newcommand*{\cost}[2][excl VAT @ 17.5\%]{\pounds#2 #1}

\begin{document}

Example 1 : \cost{50}

Example 2 : \cost{100}

Example 3 : \cost[inc VAT]{25}

Example 4 : \cost[]{75.60}

\end{document}
© 2012 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The Dickimaw parrot was painted by Magdalene Pritchett.

Terms of Use Privacy Policy Cookies Site Map FAQs