LaTeX forum ⇒ Text Formattingreferencing while the sections have * in them

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Posts: 23
Joined: Sun Aug 12, 2012 11:30 pm

referencing while the sections have * in them

Postby pemfir » Sat Jun 22, 2013 4:10 pm

Hello I have the following code, and when i want to cross reference different sections in the appendix, I get basically nothing (blank). Now this may make sense since I am using \section*{} which removes the numbering in the headings, but I was wondering if there is a way I can manually assign a string+value to the label of a section. For example, can I say \subsection*{Appendix Subsection 1 }\label{2}[App.1], so every time I want to cross reference \ref{2} it automatically outputs App.1 ?

Thank you !

  1. \documentclass[10pt,a4paper]{article}
  2. \begin{document}
  3. this is the first reference: \ref{1}
  5. this is the second reference: \ref{2}
  7. this is the third reference: \ref{3}
  9. \section*{Appendix}\label{1}
  10. \subsection*{Appendix Subsection 1 }\label{2}
  11. \subsection*{Appendix Subsection 2 }\label{3}
  12. \end{document}
Last edited by cgnieder on Sat Jun 22, 2013 5:13 pm, edited 2 times in total.
Reason: added inline code markup


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

Postby cgnieder » Sat Jun 22, 2013 5:16 pm

Basically you can't: the star form not only removes the number from the sight but also prevents that the section counter is stepped. With a \label always the last counter that has been stepped by \refstepcounter is referenced.

Now, there still are ways. You could, for example, introduce an own counter, manually step it and then reference it but I don't think this is wise: if I as a reader read a reference to App. 1 and nowhere found it because there actually is no appendix 1 (!) I'd be at least confused. Why don't you simply use numbered sections?

site moderator & package author

Return to “Text Formatting”

Who is online

Users browsing this forum: No registered users and 4 guests