mystyle.sty 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. % conditional for xetex or luatex
  3. \newif\ifxetexorluatex
  4. \ifxetex
  5. \xetexorluatextrue
  6. \else
  7. \ifluatex
  8. \xetexorluatextrue
  9. \else
  10. \xetexorluatexfalse
  11. \fi
  12. \fi
  13. %
  14. \ifxetexorluatex%
  15. \usepackage{fontspec}
  16. \usepackage{libertine} % or use \setmainfont to choose any font on your system
  17. \newfontfamily\quotefont[Ligatures=TeX]{Linux Libertine O} % selects Libertine as the quote font
  18. \else
  19. \usepackage[utf8]{inputenc}
  20. \usepackage[T1]{fontenc}
  21. \usepackage{libertine} % or any other font package
  22. \newcommand*\quotefont{\fontfamily{LinuxLibertineT-LF}} % selects Libertine as the quote font
  23. \fi
  24. \newcommand*\quotesize{60} % if quote size changes, need a way to make shifts relative
  25. % Make commands for the quotes
  26. \newcommand*{\openquote}
  27. {\tikz[remember picture,overlay,xshift=-4ex,yshift=-2.5ex]
  28. \node (OQ) {\quotefont\fontsize{\quotesize}{\quotesize}\selectfont``};\kern0pt}
  29. \newcommand*{\closequote}[1]
  30. {\tikz[remember picture,overlay,xshift=4ex,yshift={#1}]
  31. \node (CQ) {\quotefont\fontsize{\quotesize}{\quotesize}\selectfont''};}
  32. % select a colour for the shading
  33. \colorlet{shadecolor}{white}
  34. \newcommand*\shadedauthorformat{\emph} % define format for the author argument
  35. % Now a command to allow left, right and centre alignment of the author
  36. \newcommand*\authoralign[1]{%
  37. \if#1l
  38. \def\authorfill{}\def\quotefill{\hfill}
  39. \else
  40. \if#1r
  41. \def\authorfill{\hfill}\def\quotefill{}
  42. \else
  43. \if#1c
  44. \gdef\authorfill{\hfill}\def\quotefill{\hfill}
  45. \else\typeout{Invalid option}
  46. \fi
  47. \fi
  48. \fi}
  49. % wrap everything in its own environment which takes one argument (author) and one optional argument
  50. % specifying the alignment [l, r or c]
  51. %
  52. \newenvironment{shadequote}[2][l]%
  53. {\authoralign{#1}
  54. \ifblank{#2}
  55. {\def\shadequoteauthor{}\def\yshift{-2ex}\def\quotefill{\hfill}}
  56. {\def\shadequoteauthor{\par\authorfill\shadedauthorformat{#2}}\def\yshift{2ex}}
  57. \begin{snugshade}\begin{quote}\openquote}
  58. {\shadequoteauthor\quotefill\closequote{\yshift}\end{quote}\end{snugshade}}