Skip to content

Commit ad7ccbe

Browse files
committed
Improve default LaTeX hypertarget location
Link target may end up on the preceding page if placed before \chapter or \section
1 parent 4fc0d89 commit ad7ccbe

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/latexgen.cpp

+9-7
Original file line numberDiff line numberDiff line change
@@ -1338,12 +1338,6 @@ void LatexGenerator::endPageRef(const QCString &clname, const QCString &anchor)
13381338

13391339
void LatexGenerator::startTitleHead(const QCString &fileName)
13401340
{
1341-
bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1342-
bool usePDFLatex = Config_getBool(USE_PDFLATEX);
1343-
if (usePDFLatex && pdfHyperlinks && !fileName.isEmpty())
1344-
{
1345-
m_t << "\\hypertarget{" << stripPath(fileName) << "}{}";
1346-
}
13471341
int hierarchyLevel = m_hierarchyLevel;
13481342
if (Config_getBool(COMPACT_LATEX))
13491343
{
@@ -1359,7 +1353,15 @@ void LatexGenerator::startTitleHead(const QCString &fileName)
13591353
void LatexGenerator::endTitleHead(const QCString &fileName,const QCString &name)
13601354
{
13611355
m_t << "}\n";
1362-
if (!name.isEmpty())
1356+
1357+
bool pdfHyperlinks = Config_getBool(PDF_HYPERLINKS);
1358+
bool usePDFLatex = Config_getBool(USE_PDFLATEX);
1359+
if (usePDFLatex && pdfHyperlinks && !fileName.isEmpty())
1360+
{
1361+
m_t << "\\hypertarget{" << stripPath(fileName) << "}{}";
1362+
}
1363+
1364+
if (!name.isEmpty() && !fileName.isEmpty())
13631365
{
13641366
m_t << "\\label{" << stripPath(fileName) << "}\\index{";
13651367
m_t << latexEscapeLabelName(name);

0 commit comments

Comments
 (0)