TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following lines in my document:

In \secref{2}, a very basic review is presented. \secref{3} compares different structures.

\secref{3} must start with a capital letter. However, LaTeX makes it start with its ordinary label "section" (with a small "s").

How can I correct this?

PS: It does not need to be automatic. Any particular (manual) solution is fine for me.

share|improve this question
Which LaTeX package provides the command \secref? – Mico Sep 14 '11 at 18:21
It is a lyx generated command: \secref[1]{\ref{sec:#1} – user460153 Sep 14 '11 at 18:25
Thanks. I've adjusted the first paragraph of my answer below now that I know it's a lyx command. – Mico Sep 14 '11 at 18:51
up vote 5 down vote accepted

(Edited after I learned from the OP that the command is used in lyx.)

The simplest solution may be to define a new command, \Secref, that starts with an uppercase letter S, as in


That way, if you need the capitalized form of the noun, you can switch from \secref to \Secref.

If you're willing to use the cleveref package, you could use the command \cref{2} to generate Section 2, and by typing \cref{2,3} you'd generate Sections 2 and 3; note the automatic use of the plural form of the noun in the second example. Cleveref's commands are "clever" enough (pun intended) to determine the type of the entity being cross-referenced, and the commands then select the noun that goes with it. The forms of the nouns (e.g., uppercase, lowercase) that get prefixed to the referenced entity are fully customizable. And, if you use babel, the nouns will be set to any one of (currently) six or seven languages, i.e., you're not "stuck" with just the English language nouns. Finally, if you're so inclined, you can set up the package so that \cref will use a lowercase starting letter while \Cref will use an uppercase starting letter (useful when starting off a sentence with a cross-reference).

These examples assume that you've given the labels 2 and 3 to sections 2 and 3 of your paper. As a general comment, you may want to make a habit of using slightly longer label strings. One common technique is to start all equation labels with eq:, all (sub,subsub)section labels with sec:, all figure labels with fig:, etc. If nothing else, using labels in this manner will save you a lot of time down the line when the need to debug some of the cross-references arises.

share|improve this answer
Good comment with respect to label strings. – lockstep Sep 14 '11 at 18:52

LyX uses the refstyle package to format cross-references. refstyle supports capitalized macro versions like \Secref for use at the start of sentences. I don't know if LyX features an interface for \Secref & friends -- if not, insert the command as "evil red text" (LaTeX code).

For users that don't depend on LyX: The cleveref package also features capitalized macro versions, and its \cref/\Cref macro is able to automatically detect label types and to format cross-references accordingly.





In \cref{2}, a very basic review is presented. \Cref{3} compares different structures.



share|improve this answer
+1 for cleveref. I'd add that you can customize \cref for all of the objects that it references. In the case of sections, you can use something like \crefname{section}{Section}{Sections} for \cref, and \Crefname{section}{Section}{Sections} for \Cref – cmhughes Sep 14 '11 at 18:54

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.