Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Q25 如何插入网址或者超链接,并修改显示方式,比如使用package hyperref时用\href{url}{description}, 去掉默认的颜色框,设置显示斜体等 #32

Open
Lihua1990 opened this issue Jan 3, 2020 · 2 comments

Comments

@Lihua1990
Copy link
Collaborator

No description provided.

@Lihua1990 Lihua1990 changed the title Q25 如何插入网址或者超链接,并修改显示方式,比如使用package hyperref时用\ref{url}{description}, 去掉默认的颜色框,设置显示斜体等 Q25 如何插入网址或者超链接,并修改显示方式,比如使用package hyperref时用\href{url}{description}, 去掉默认的颜色框,设置显示斜体等 Jan 3, 2020
@EthanDeng
Copy link
Owner

EthanDeng commented Jan 4, 2020

插入网址和超链接用到的宏包是 hyperref,命令也是你提到的 \href 命令,如果你不想要超链接文本周围颜色边框,可以使用

\hypersetup{hidelinks} %or
% \hypersetup{pdfborder={0 0 0}}

如果你还想要字体为斜体,对于 \href 没有直接的设置,所以需要自行设置字体

\href{https://github.com/EthanDeng/mhlatex/}{\textit{GitHub:mhlatex}}

如果使用 \url 命令,可以通过 \UrlFont 设置字体,导言区使用

\renewcommand\UrlFont{\rmfamily\itshape}

正文使用

\url{https://github.com/EthanDeng/mhlatex/}

即可获得斜体,而无需使用 \textit命令。

@EthanDeng
Copy link
Owner

还有另外一种方法就是利用 \href 新建一个命令:

\newcommand{\link}[2]{\href{#1}{\textit{#2}}}

然后正文可以使用

\link{https://github.com/EthanDeng/mhlatex/}{GitHub:mhlatex}

得到斜体。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants