LaTeX forum ⇒ Text Formattinglowering a character in a section heading. Topic is solved

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
AliceWonder
Posts: 28
Joined: Wed Oct 31, 2012 12:04 am

lowering a character in a section heading.

Postby AliceWonder » Mon Aug 19, 2013 9:53 pm

TeXLive 2013 as distributed from TUG running in Fedora 18 x86_64.

  1. \newcommand{\nix}{\textsc{Un\raisebox{-0.3\height}{*}x}}


works in paragraph mode, it puts the * at the correct height relative to the small caps N and X (at least with the font I am using).

However if I then use the \nix{} command in a \section{} command it fails. What is the proper way to accomplish what I want to accomplish so it is not restricted to paragraphs?

Tags:

User avatar
cgnieder
Site Moderator
Posts: 1988
Joined: Sat Apr 16, 2011 7:27 pm

Postby cgnieder » Mon Aug 19, 2013 10:21 pm

Most of all your macro throws an error when used in a \section:

  1. \documentclass{article}
  2. \usepackage[T1]{fontenc}
  3. \newcommand{\nix}{\textsc{Un\raisebox{-0.3\height}{*}x}}
  4. \begin{document}
  5.  
  6. \nix
  7.  
  8. \section{\nix}
  9.  
  10. \end{document}


gives

  1. ! Argument of \@sect has an extra }.
  2. <inserted text>
  3. \par
  4. l.8 \section{\nix}
  5.  
  6. Runaway argument?
  7. {\normalfont \Large \bfseries }{\@rsbox {-0.3\height }}\def \reserved@b \ETC.
  8. ! Paragraph ended before \@sect was complete.
  9. <to be read again>
  10. \par
  11. l.8 \section{\nix}


Here is an alternative solution:

  1. \documentclass{article}
  2. \usepackage[T1]{fontenc}
  3.  
  4. % only so we can test the different font variants that `lmodern' does not
  5. % have:
  6. \usepackage{libertine}
  7.  
  8. \newcommand{\nix}{\textsc{Un\lower.6ex\hbox{*}x}}
  9.  
  10. % a command for testing:
  11. \newcommand\test[1]{%
  12. \begingroup
  13. #1 \tiny \nix
  14. \footnotesize\nix
  15. \small\nix
  16. \normalsize\nix
  17. \large\nix
  18. \Large\nix
  19. \LARGE\nix
  20. \huge\nix
  21. \Huge\nix
  22. \endgroup
  23. }
  24.  
  25. \begin{document}
  26.  
  27. \nix
  28.  
  29. \section{\nix}
  30.  
  31. \test{}
  32.  
  33. \noindent\test{\bfseries}
  34.  
  35. \noindent\test{\itshape}
  36.  
  37. \noindent\test{\itshape\bfseries}
  38.  
  39. \noindent\test{\sffamily}
  40.  
  41. \noindent\test{\sffamily\bfseries}
  42.  
  43. \noindent\test{\sffamily\itshape\bfseries}
  44.  
  45.  
  46. \end{document}


Regards
Clemens
------------------------------
chemmacros · chemformula · leadsheets · xsim

AliceWonder
Posts: 28
Joined: Wed Oct 31, 2012 12:04 am

Postby AliceWonder » Mon Aug 19, 2013 10:42 pm

Thank you! That works very well.


Return to “Text Formatting”

Who is online

Users browsing this forum: No registered users and 5 guests