我想知道如何在 LuaLaTex 中为 URL 添加下划线和颜色。我可以添加下划线,但无法将 URL 和下划线更改为蓝色。字体是 Calibri。谢谢!
% code used in LuaLaTex
\documentclass{article}
\usepackage{fancyhdr,graphicx,xcolor,colortbl}
\usepackage{fontspec}
\setmainfont{Calibri}
\begin{document}
Further information can be found online (\underline {http://findsource.org/})
\end{document}
答案1
尝试此代码
\documentclass{article}
\usepackage{fancyhdr,graphicx,xcolor,colortbl}
\usepackage{fontspec}
\usepackage[colorlinks,urlcolor=blue]{hyperref}
\setmainfont{Calibri}
\begin{document}
Further information can be found online {\color{blue}\underline{\href{http://findsource.org/}{http://findsource.org/}}}
\end{document}
它使用带有选项和的hyperref
包。colorlinks
urlcolor=blue
答案2
再试一次,这次重新定义\url
命令:
\documentclass{article}
\usepackage{fancyhdr,graphicx,xcolor,colortbl}
\usepackage{fontspec}
\usepackage{hyperref}
\DeclareUrlCommand{\url}{%
\def\UrlFont{\color{blue}\normalfont}% Adding a little color
\def\UrlLeft##1\UrlRight{\underline{##1}}% Underlining the url
}
\setmainfont{Calibri}
\begin{document}
Further information can be found online \url{http://findsource.org/}
\end{document}