I recall that, originally, the Programmer's Guide—both in its PDF version and in printed form—displayed all hyperlinks in a color other than the black used for the regular text. If I remember correctly, it was a "dark red" shade. This was very helpful when viewing the PDF on screen.
Nowadays, this feature—having hyperlinks appear in a different color within the PDF—is gone; I’m not sure why.
Restoring it would require a Texinfo expert, but I’ve tried asking about this on this site before, without success.
Today, I tried asking Gemini AI for an explanation.
I have included the prompts and responses below.
Apparently, it shouldn't be too complicated.
However, it will require some experimentation and testing.
Unfortunately, I am not in a position to generate the PDF myself.
I would like to ask Vincent if he might have the time—and the inclination—to look into this.
======================================================
QUESTION N.1
I am using the Texinfo language to write the technical manual for the GnuCOBOL compiler.
I am using the @pxref{Dynamic vs Static Subprograms} command to create hyperlinks to other chapters within the same manual in the PDF I intend to generate.
I would like the text containing these hyperlinks to appear in a color other than the black used for the rest of the text in the generated PDF.
How can I achieve this?
The relevant files can be found here: https://sourceforge.net/p/gnucobol/code/HEAD/tree/external-doc/guide/
ANSWER N.1
To change the color of hyperlinks (such as those generated by @pxref) in the PDF output generated by Texinfo, you can use the built-in TeX/LaTeX control commands provided by Texinfo's PDF output engine (which relies on hyperref).
Specifically, Texinfo recognizes commands like \linkcolor and \urlcolor to change the colors of cross-references and URLs in the generated PDF. By default, these are set to black.
You can inject TeX commands into your Texinfo source file (.texi) using @iftex ... @end iftex blocks so that they only apply when generating the PDF via TeX, without affecting Info or HTML outputs.
Add the following lines near the top of your main Texinfo file (e.g., right after your header declarations):
@iftex
@tex
\global\def\linkcolor{blue} % Or use a custom color / RGB value
@end tex
@end iftex
Alternatively, if you want to use a specific color defined via xcolor (which Texinfo/hyperref includes), or if you want to configure colorlinks explicitly, you can configure \hypersetup directly within an @tex block:
@iftex
@tex
\hypersetup{
colorlinks=true,
linkcolor=blue,
urlcolor=blue
}
@end tex
@end iftex
\linkcolor: Changes the color for cross-references to nodes and chapters (which affects @pxref, @xref, @ref).\urlcolor: Changes the color for web URLs and email links (@url, @uref, @email).colorlinks=true: Ensures that the text itself is colored rather than enclosed in a colored bounding box.======================================================
QUESTION N.2
Can you provide further explanations?
ANSWER N.2
Here is a deeper breakdown of how Texinfo handles PDF generation under the hood, where to place these configuration commands in your manual, and how you can customize the colors to fit your exact preference.
When you run texi2pdf or make pdf on a Texinfo manual, Texinfo does not generate the PDF directly. Instead, it translates your .texi file into a specialized LaTeX/TeX file and processes it through pdfTeX.
Because of this, Texinfo automatically loads standard LaTeX packages—most notably hyperref (which manages all hyperlinks, cross-references, and PDF metadata) and xcolor (which handles color definitions). This means you can inject raw TeX/LaTeX commands using @iftex ... @end iftex blocks to directly configure these underlying packages.
.texi FileYou should place the configuration snippet in the preamble of your main .texi file (usually the file defined as your main document, like gnucobol.texi).
Specifically, place it right after your document header definitions and filename declarations, but before the @node Top and the main content. For example:
\input texinfo @c -*-texinfo-*-
@setfilename gnucobol.info
@settitle GnuCOBOL Programmer's Guide
@iftex
@tex
\hypersetup{
colorlinks=true,
linkcolor=blue,
urlcolor=blue
}
@end tex
@end iftex
@node Top
@top Introduction
...
By default, TeX recognizes a basic set of color names (blue, red, green, cyan, magenta, yellow, black, etc.). However, standard primary blue can sometimes look overly harsh in a printed or digital manual.
Because the xcolor package is available, you can define your own custom RGB or Hex colors using \definecolor.
@iftex
@tex
% Define a custom professional navy blue color
\definecolor{ManualLinkColor}{RGB}{12, 84, 156}
\hypersetup{
colorlinks=true,
linkcolor=ManualLinkColor, % For internal cross-references (@pxref, @xref)
urlcolor=ManualLinkColor, % For web links (@url, @uref)
citecolor=ManualLinkColor % For citations (if applicable)
}
@end tex
@end iftex
hyperref OptionsIf you want finer control over which elements get colored, here are the primary parameters you can pass inside \hypersetup{...}:
colorlinks=true: Switches from the default behavior (which encloses links in ugly colored rectangular boxes/borders) to coloring the text characters themselves.linkcolor: Controls internal document links (generated by @pxref, @xref, @ref, and table of contents entries).urlcolor: Controls external hyperlinks pointing to websites or emails (generated by @url, @uref, @email).filecolor: Controls links pointing to local files on disk.citecolor: Controls bibliographic citations.If you set colorlinks=false (or omit it), TeX will wrap your @pxref text in thin colored boxes instead of changing the text color, which is generally discouraged for modern technical documentation as it makes PDFs look cluttered.
======================================================
QUESTION N.3
So, which files do I need to modify, and what should I insert?
ANSWER N.3
To customize the link colors in your PDF output for the GnuCOBOL guide, you need to modify the main master .texi source file located in the external-doc/guide/ repository.
Look for the root Texinfo file (typically named something like gnucobpg.texi or the primary top-level driver file that sets the @settitle and includes the individual chapters).
Open that main file and locate the document header/preamble—right after the initial lines (\input texinfo and @settitle), but before the main content nodes (like @node Top).
Insert the following @iftex block:
@iftex
@tex
\hypersetup{
colorlinks=true,
linkcolor=blue, % Changes the color of @pxref, @xref, and table of contents links
urlcolor=blue % Changes the color of web and email links (@url, @uref)
}
@end tex
@end iftex
\input texinfo @c -*-texinfo-*-
@setfilename gnucobpg.info
@settitle GnuCOBOL Programmer's Guide
@iftex
@tex
\hypersetup{
colorlinks=true,
linkcolor=blue,
urlcolor=blue
}
@end tex
@end iftex
@node Top
@top Introduction
...
If standard blue is too harsh for the manual's design, you can define a custom RGB color using the underlying xcolor package (which is loaded automatically by Texinfo):
@iftex
@tex
\definecolor{CobolLinkBlue}{RGB}{12, 84, 156}
\hypersetup{
colorlinks=true,
linkcolor=CobolLinkBlue,
urlcolor=CobolLinkBlue
}
@end tex
@end iftex
Once added, re-run your PDF compilation script (e.g., make pdf or texi2pdf), and your @pxref hyperlinks will render in your chosen color instead of black.
Diff:
Just used the first example at top of gnucobpg.texi but with no noticeable results.
Please try yourself and a example of a hyper link as close to the start as poss and save it as note here and I will run it for you.
Just seen the 'Error window'
Syntax Error (934270): Unknown operator 'blue'
Syntax Error (934273): Too few (0) args to 'rg' operator
There are a lot of these :)
Following Gemini's suggestions, I tried inserting the following commands:
If you could run a test... the modified file
gnucobpg.texiis attached.Building Programmer's Guide...
texi2pdf -q -c --command=@afourpaper -o PDFs/gnucobpg-a4.pdf gnucobpg.texi
egrep: warning: egrep is obsolescent; using grep -E
/home/vince/bin/texi2dvi: pdfetex exited with bad status, quitting.
make: *** [Makefile:112: PDFs/gnucobpg-a4.pdf] Error 1
Then ran manually ---
texi2pdf -c --command=@afourpaper -o PDFs/gnucobpg-a4.pdf gnucobpg.texi
egrep: warning: egrep is obsolescent; using grep -E
This is pdfTeX, Version 3.141592653-2.6-1.40.29 (TeX Live 2026/Mageia) (preloaded format=pdfetex)
restricted \write18 enabled.
entering extended mode
(../../../gnucobpg-a4.t2d/pdf/xtr/gnucobpg.texi
(/home/vince/cobolcompiler-sources/manual/guide/texinfo.tex
Loading texinfo [version 2017-06-04.19]: pdf, fonts, markup, glyphs,
page headings, tables, conditionals, indexing, sectioning, toc, environments,
defuns, macros, cross references, insertions,
(/usr/share/texmf-dist/tex/generic/epsf/epsf.tex
This is `epsf.tex' v2.7.4 <14 February 2011>
) localization, formatting, and turning on texinfo input format.)
(/home/vince/cobolcompiler-sources/manual/guide/Macros.texi) [1{/usr/share/texm
f-dist/fonts/map/pdftex/updmap/pdftex.map}] [2] [-1] [-2]
../../../gnucobpg-a4.t2d/pdf/xtr/gnucobpg.texi:104: Undefined control sequence.
l.104 \definecolor
{CobolLinkBlue}{RGB}{12, 84, 156}
?
At this point used quit
It might be useful to present my initial question to Gemini,
and subsequently provide Gemini with the log you obtained.
I am attaching a new file that uses a different and simpler method for specifying hyperlink colors.
Could you please give it another try?
Thanks in advance.
Last edit: Eugenio Di Lorenzo 2 days ago
Built and committed as I have no idea were to look for such a change.
The modification was intended to change the color of the hyperlinks present in the manual's text.
To locate the hyperlinks, you can search for the string "
(see".If you hover your cursor over this text, the pointer will change, and you can click on it to jump to the corresponding topic.
Unfortunately, the change did not work as intended and failed to produce the expected result.
The text representing the hyperlink has remained black—just as it was before the modification—whereas it should have turned blue.
For example, on page 16, there is the text:
"
(see Section 3.1 [COPY], page 58)."Although this is clickable, it has remained black, matching the rest of the text in the manual, instead of turning blue.
I will await the next mod.
Here you are.
Now inserted following commands in another position (after
@comment %**end of header(a new Gemini answer ...)
New file attached.
That worked but colour very light. Uploading in a minute.
Wow ! We did it!
So, I’m attaching a file with different—and (hopefully) better—colors.
uploaded - differing colour but still very light.