I'd like to use namerefs within a sentence, and have the case of the resulting text match the position within the sentence. The section title is naturally title case, but is there some command to either a) force lowercase of namerefs (\lowercase{} doesn't work), or b) insert init-case, i.e., uppercase the initial word if it's at the beginning of a sentence, lowercase elsewhere?


[definition of an object]
\nameref{sec:obj} instance variables are often called simply "\nameref{sec:obj}".

should produce:

[definition of an object]
Object instance variables are often called simply "object".

Note case difference at the start and in the middle of the sentence.

  • 2
    An example would be useful here: from the description it is pretty hard to follow what is required. – Joseph Wright Aug 13 '10 at 14:27
  • I don't think the <a href="tex.stackexchange.com/questions/tagged/…> tag is appropriate for this question; the other two articles with the tag are talking about the cases environment from amsmath... – SamB Sep 27 '10 at 21:17
  • Whoops, apparently that's not the way to do a hyperlink in a comment. (Wishes comments were previewable...) – SamB Sep 27 '10 at 21:24

I think that it would be hard for TeX to automatically know whether the \nameref should be title-case, lowercase, or init-case. But if you are prepared to tell TeX, then this can be done. I don't claim that this is the most elegant method, but it's the one that I use in a similar situation.





\section{\nmu This \nmu Is a \nmu Section}

\lnameref{sec} is a section.

\nameref{sec} is a section.

\fnameref{sec} is a section.

\nameref{sec} is a section.



1 This Is a Section

this is a section is a section.
This Is a Section is a section.
This is a section is a section.
This Is a Section is a section.

(It makes a modicum more sense when the "this is a section" looks like a link since then it looks like '"this is a section" is a section'. Only when I transcribed it did I realise how daft it looked.)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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