About
Shop
LaTeX
Software
Books
Gallery
News
Contact
Blog
Settings
Account
Latest news 2024-12-13: Ebook sale (12th December 2024 – 1st January 2025): cybercrime fiction short stories Unsocial Media and Smile for the Camera free; crime fiction short story The Briefcase 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