MWE:  \documentclass{article}  \usepackage{hyperref}  \begin{document}  \newcommand*{\ordinal}{First} \section{\ordinal{} Section} \label{sec:first}  \renewcommand*{\ordinal}{Second} \section{\ordinal{} Section} \label{sec:second}  I want this to say ``First Section'': \nameref{sec:first}  \end{document}   I end up with \newlabel{sec:first}{{1}{1}{\ordinal {} Section}{section.1}{}} in the .aux file, whereas I wanted \ordinal{} to be expanded immediately when the \label command is executed.  Is there any sane way to make hyperref expand the section title when writing out the \newlabel command?
124132
What's the proper way to reference a section with a counter in the title? The TOC generates correctly, but the cross references aren't so lucky.  MWE:  \documentclass[letterpaper, 12pt, twoside]{exam}  \usepackage{hyperref}  \newcounter{KSRLessonNumberCounter} \setcounter{KSRLessonNumberCounter}{1} \newcommand{\KSRSection}[2][\value{KSRLessonNumberCounter}]{         \setcounter{KSRLessonNumberCounter}{#1}         \section*{Lesson \arabic{KSRLessonNumberCounter}: #2}         \addcontentsline{toc}{section}{Lesson \arabic{KSRLessonNumberCounter}: {#2}}         \stepcounter{KSRLessonNumberCounter} } \newcommand{\KSRSubsection}[1]{         \subsection*{#1}         \addcontentsline{toc}{subsection}{#1} } \newcommand{\KSRLessonNumber}{ }  \begin{document}  \KSRSection{Sample}  This is the first lesson. The second lesson is \nameref{sec:blah}.  \KSRSection{Blah} \label{sec:blah}  This is the second section  \KSRSection{Lorem Ipsum}  Dollars are Set in \nameref{sec:blah}.  \end{document}
105475
I have many unnumbered sections in my report (more than 100), all created with:  \section*{section name}  I want to find a way to easily add them all to the TOC (specifically to a minitoc). Since I use the * to remove the numbering, they won't appear in TOC. I found out in minitoc documentation that I should use:  \addcontentsline{toc}{section}{repeat here section title}   However, I don't want to have a duplicated title in every section, or even to change all the involved files to add those already written sections to the TOC. How to add those sections' names to the minitoc without using the addcontentsline command? Is it possible?
120941
Is there a way to make a cross reference to a label of a header with custom text? That is, its text should differ from the Header text, or its number or page (not like the predefined formats in Lyx). Something like the the hyperlinks or bookmarks in MS word, and in such a way that I can write the different text for each cross-reference individually. I'm not looking to define a new format for the references.  For example, if the header text is "State and Path functions", I want to make a cross reference to it with the text "state function".
32329
I am currently writing my PhD thesis, and I have trouble defining a common style for my global TOC and the partial TOCs generated by titletoc.  Basically if you check the following MWE, I like the general style of the global TOC, in particular the fact that hyperref links include the labels. However, I find that the dotted lines in the global TOC are not dense enough, and prefer those of the partial TOCs.  \documentclass[12pt,a4paper]{book}  \usepackage{caption} \usepackage{titletoc} \usepackage[colorlinks]{hyperref} \usepackage{lipsum}  \renewcommand{\cleardoublepage}{\clearpage}  \newcommand{\PartialToc}{\vspace*{0.5pc}\vbox{\bf\large\noindent Chapter contents}\vspace*{0.3pc}\startcontents[chapters]\vspace*{0.3pc}\printcontents[chapters]{p}{1}{}\vspace*{0.3pc}}  \begin{document}  % Custom style for partial TOCs \titlecontents{psection}[3.6em]{\small\bfseries}{\contentslabel{1.8em}}{}{\mdseries\titlerule*[0.25pc]{.}\contentspage\hspace*{1.8em}}{} \titlecontents{psubsection}[6.0em]{\small}{\contentslabel{2.4em}}{}{\titlerule*[0.25pc]{.}\contentspage\hspace*{1.8em}}{}  \tableofcontents \listoffigures \listoftables  \chapter{Chapter 1}  \vfill \lipsum[1-2] \vfill\PartialToc\clearpage  \section{Section 1} \lipsum[1]  \begin{figure}[t]     \caption{Figure 1} \end{figure}  \section{Section 2} \lipsum[1] \subsection{Subsection 2.1} \lipsum[1] \subsection{Subsection 2.1} \lipsum[1] \section{Section 3} \lipsum[1]  \begin{table}[t]     \caption{Table 1} \end{table}  \end{document}   Therefore, I tried to increase the density of the dotted lines in the global TOC, by adding the following titletoc style declarations after \begin{document}:  \titlecontents{section}[3.8em]{}{\contentslabel{2.3em}}{\hspace*{-2.3em}}{\titlerule*[0.25pc]{.}\contentspage}{} \titlecontents{subsection}[6.2em]{}{\contentslabel{2.9em}}{}{\titlerule*[0.25pc]{.}\contentspage}{}   However, in this case, the hyperref links are changed, which I would like to avoid (no I am not a maniac...). Is there a way to achieve this ? And can this also be used to make the hyperref links in the partial TOCs include the labels ?  And as a subsidiary question, how do I assign the same style to entries in the List of Figures and List of Tables ?  Thank you for your help
29242
\documentclass{article} \usepackage{hyperref} \usepackage{lipsum} \usepackage{polski} \begin{document} \begin{figure} . \caption{A figure} \label{fff} \end{figure} \lipsum[1]  Rysunek~\ref{fff} jest zabawny, bo na rysunku~\ref{fff} nic nie ma. \end{document}   In this sample, a clickable link is added to output PDF for 1 and 1. I want to be able to change them to Rysunek 1 and rysunku 1. I want to be able to put any other text + number of the figure into a hyperlink. The word rysunek can't be set in preamble as a default because there is a declension in Polish. The same question goes for tables, listings, equations, pages (pageref) etc (basically any reference).  HTML equivalent of my MWE:    Rysunek &lt;href="fff"&gt;1&lt;/a&gt; jest zabawny, bo na rysunku &lt;a href="fff"&gt;1&lt;/a&gt; nic nie ma.   I want it to be:    &lt;href="fff"&gt;Rysunek 1&lt;/a&gt; jest zabawny, bo na &lt;a href="fff"&gt;rysunku 1&lt;/a&gt; nic nie ma.
36040
Is there a package that automatically inserts the ToC level of the reference I inserted?  Section 1.1 \label{a} Subsection 1.1.1 \label{b} Subsection 1.1.2  \label{c}   So that the text:  Blah \superref{a} and \superref{b} and \superref{c}   becomes:  Blah Section 1.1 and Subsection 1.1.1 and Subsection 1.1.2   So that it automatically adapts if I change the level of a label?
14902
\nameref breaks for the star versions of section, paragraph when titlesec is loaded. I have a document that numbers paragraphs by default, but I have a few I do not want to number but would like to refer to. These are marked with \paragraph*, however, if the titlesec package is loaded at the same time, it causes nameref to display an empty string (the link box of hyperref is still visible).  MWE:  \documentclass[12pt]{article} \usepackage[sf]{titlesec} %comment this out and it works fine. \usepackage{hyperref} \begin{document} \section{Sections} \label{sec} This is \nameref{sec} \paragraph{A named Paragraph} \label{par} This is \nameref{par} \paragraph*{A starred named Paragraph} \label{par:star} This is \nameref{par:star} \end{document}   I suspect titlesec causes this defect for ALL star variants of sectioning commands but have not tested this. For me only paragraph* is relevant however a fix for all variants would be the best.  I have a hunch it might be related to this:  however this happens to go way beyond my latex knowledge and is just "magic" for me.
32176
I'm having a bit of trouble with section numbering. When I use \section{} it starts at 0.1 rather than 1.0.   Here's my preamble:   \documentclass[12pt]{report} \usepackage{hyperref} \usepackage[landscape]{geometry} \usepackage{wallpaper} \usepackage{fullpage}   Any thoughts?
98134
I am writing my thesis and need to put 'Appendix' before the numbering (A, B, C, ...) in the table of contents (TOC), the chapter title and in the header. I'd also like for \autoref{} to output 'Appendix A'.  I am using the scrbook class and have tried several different ways to achieve this but nothing gives me the desired output.  I want the title to appear as below so that it reads 'Appendix A (Title)'. This is also how I want it to appear in the TOC and in my header.    I've tried using the KOMA option appendixprefix=true but this splits Appendix A and More Information onto separate lines and doesn't put 'Appendix' before A in the TOC.  I've tried redefining \thechapter with \renewcommand{\thechapter}{Appendix \Alph{chapter} which gives me the desired output in the title and header of my document but the table of contents output is below and \autoref{}'s output is 'Appendix Appendix A'.    I've tried the appendix package too but this won't add Appendix to the title in the main body, only to the TOC.  I've also tried some other hacks which work in both the TOC and the title but then show the previous chapter in the header.  I set my headers using the following  \usepackage{fancyhdr}  \setlength{\headheight}{15pt}  \pagestyle{fancy} \renewcommand{\chaptermark}[1]{ \markboth{\thechapter~#1}{} } % Adds chapter number name to right header \renewcommand{\sectionmark}[1]{ \markright{\thesection~#1}{} } % Adds section name to left header   I'd really appreciate some help with this as I can't find a solution which works for my 3 main cases of title, TOC and header using the scrbook class.  MWE:  \documentclass[12pt,a4paper,oneside,pointlessnumbers]{scrbook}  \usepackage[english]{babel} \usepackage{blindtext} \usepackage{fancyhdr} \usepackage[colorlinks]{hyperref}  \setlength{\headheight}{15pt}  \pagestyle{fancy} \renewcommand{\chaptermark}[1]{ \markboth{\thechapter~#1}{} } \renewcommand{\sectionmark}[1]{ \markright{\thesection~#1}{} }   \begin{document}  \frontmatter \tableofcontents  \mainmatter \blinddocument  \appendix  \chapter{More Information} \label{app:first} \section{Another Section} \autoref{app:first}  \Blindtext  \end{document}
26938
With the following example, I get a different vertical distance between "Contents" and "1 bar 5" and "foo" and "Lorem". How do I get the first entry of the TOC to the same height as "Lorem ipsum", that is the base line should be the red rule in the image below:    \documentclass{book} \begin{document} \tableofcontents  \chapter*{foo} Lorem ipsum  \chapter{bar} Lorem ipsum   \end{document}
89824
Sometimes I want to refer (using \ref) a \label from some other tex file. What is the right way to do it?  (It's, of course, possible to \include all files in one and then use \includeonly — but it breaks e.g. page and section numbering.)
28155
I have a document which requires many levels of sectioning. I have sections, subsections and subsubsections, but require one more level below that. I can't change the sections to be parts and move everything up a level, as this document will eventually be included in another document which has parts/chapters already.  I see that the \paragraph command is used for defining the section level below subsubsection, but that doesn't produce headings in the same way that subsection and subsubsection do. Is there any way to either (1) change the \paragraph command so that it works like subsubsection but just adds another number - ie. 1.2.3.4 or (2) create a \subsubsubsection command to do the same thing?
45598
\documentclass[11pt,a4paper]{article}     \usepackage[T1]{fontenc}     \usepackage{lipsum}     \usepackage{tocloft}     \begin{document}      \tableofcontents     \thispagestyle{empty}         \newpage      \section{Preface} %want section number to be 0     \thispagestyle{empty}         \pagenumbering{roman}     \lipsum[1-3]     \newpage      \section{Start From Here}     \lipsum[1-5]      \section{And So On...}     \lipsum[1-5]     \end{document}      How do I get section numbering to start at 0?   Edit: I know I can do \section*{Preface}, but that removes it from the ToC, which isn't what I want.
3561
When creating an acronyms/initialisms in a document which will be referenced throughout the document, what is the proper way to display it for the first time? ("Word") or just (Word)?
68599
The following code is in the preamble of my LaTeX document:  \documentclass{llncs} \usepackage{amsmath,amssymb} \usepackage{url} \usepackage[algoruled,vlined]{algorithm2e} \usepackage{graphicx,subfigure}   \usepackage{hyperref}  \hypersetup{colorlinks=true,citecolor=blue}   \numberwithin{equation}{section} % numbering according to the section \bibliographystyle{plain}  %Choose a bibliograhpic style \begin{document}  \title{The Title} \maketitle \section{A} \label{sect:A} \subsection{a} \subsection{b} % ... \section{B} \label{sect:B} \subsection{a} \subsection{b} % ... \section{C} \label{sect:C} \subsection{a} \subsection{b} % ... \end{document}   Note that the text is organized into sections and subsection. However, after compiling the code, the Adobe PDF preview does not show the "tree" branching on the left. Instead, it just shows "The Title", and that option has no branching with the "+/-" sings. How could I achieve this?
13525
I'm making pdf bookmarks with hyperref and cleveref packages. However, the pdf bookmarks show the label I defined, rather than the theorem name the label refers to. Here's the code:  \documentclass{article}  \usepackage{hyperref} \usepackage{cleveref}  \newtheorem{theorem}{Theorem}  \begin{document}  \section{Section 1} \begin{theorem}\label{some label}     This is a theorem. \end{theorem}  \section{Proof to \Cref{some label}}  \end{document}   And here's the pdf:   Any idea how to change the label to "Proof to Theorem 1" instead of "Proof to some label"?
27806
I want to compile sections of the article independently. Clearly, I can make their numbers right just by using something like \setcounter{section}{4}.  How can I get something like \ref{VeryUsefulTheorem} working if the command \label{VeryUsefulTheorem} is in another section (i.e., in another TeX file, which is compiled to its own PDF file)?  I'm using the  package, and, therefore, inter-document links are clickable. Is it possible to make links to a stuff in a different PDF file clickable?