captionsetup url 颜色选择

captionsetup url 颜色选择

我已将标题字体颜色更改为灰色,如下面的屏幕截图所示。我的问题是参考文献是黑色(我在 中选择了hypersetup),如何将其更改为与标题文本的其余部分一样为灰色,而标题以外的所有其他地方的链接都是黑色?

我已经尝试过linkcolorurlcolor,但似乎标题包不支持这些选项。

在此处输入图片描述

以下是我的序言:

\documentclass[11pt, twoside]{report}

\usepackage{hyperref} % clickable references
\hypersetup{
    colorlinks,
    citecolor=black,
    filecolor=black,
    linkcolor=black,
    urlcolor=black
}


% ------- Images ------- %
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\DeclareCaptionFont{gray}{\color{gray}}
\captionsetup{
    textfont={footnotesize,sc,gray},
    font={footnotesize,sc,gray},
    %linkcolor={footnotesize,sc,gray},
}



% ------- Colors ------- %
\usepackage{color}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}

表格和方程的代码如下:

\begin{equation}
1+K_1K_2\frac{(s+2)^2}{(s+10)(s+100)(s^2+3.535s+6.25)}=0
\label{eq:part_b_characteristic_eq}
\end{equation}


\begin{table}[h!]
\begin{center}
\begin{tabular}{c|l}
$s_n$ & pole\\\hline
$s_1$ & $-100 + 0i$\\
$s_2$ & $-10 + 0i$\\
$s_3$ & $-1.77 + 1.77i$\\
$s_4$ & $-1.77 - 1.77i$\\
\end{tabular}
\end{center}
\caption{Pole values of the system from equation \eqref{eq:part_b_characteristic_eq}}
\label{tab:poles_from_characteristic_eq_partb}
\end{table}

答案1

只需在定义标题字体时添加规范;请注意,您应该hyperref最后加载。

\documentclass[11pt, twoside]{report}

\usepackage{amsmath} % it was missing


% ------- Images ------- %
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}

% ------- Colors ------- %
\usepackage{color}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}

% hyperref

\usepackage{hyperref} % clickable references
\hypersetup{
    colorlinks,
    citecolor=black,
    filecolor=black,
    linkcolor=black,
    urlcolor=black
}

% customizations

\DeclareCaptionFont{gray}{\color{gray}\hypersetup{linkcolor=gray}}
\captionsetup{
    textfont={footnotesize,sc,gray},
    font={footnotesize,sc,gray},
}

\begin{document}

\begin{equation}
1+K_1K_2\frac{(s+2)^2}{(s+10)(s+100)(s^2+3.535s+6.25)}=0
\label{eq:part_b_characteristic_eq}
\end{equation}


\begin{table}[h!]
\begin{center}
\begin{tabular}{c|l}
$s_n$ & pole\\\hline
$s_1$ & $-100 + 0i$\\
$s_2$ & $-10 + 0i$\\
$s_3$ & $-1.77 + 1.77i$\\
$s_4$ & $-1.77 - 1.77i$\\
\end{tabular}
\end{center}
\caption{Pole values of the system from equation \eqref{eq:part_b_characteristic_eq}}
\label{tab:poles_from_characteristic_eq_partb}
\end{table}

\end{document}

在此处输入图片描述

答案2

我准备了两个新命令\mref\mpageref分别调用\hyperref(方法 1)或\hypersetup{linkcolor=...}(方法 2)。如果它符合您的需求,请尝试一下。

%! *latex mal-url-color.tex
\documentclass[11pt, twoside]{report}
\pagestyle{empty}
\usepackage{amsmath}
\usepackage{hyperref} % clickable references
\hypersetup{
    colorlinks,
    citecolor=black,
    filecolor=black,
    linkcolor=gray, % red
    urlcolor=black,
   }
% ------- Images ------- %
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\DeclareCaptionFont{gray}{\color{gray}}
\captionsetup{
    textfont={footnotesize,sc,gray},
    font={footnotesize,sc,gray},
    %linkcolor={footnotesize,sc,gray},
    }
% ------- Colors ------- %
\usepackage{color}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}

% Approach number 1
%\def\mref#1{\hyperref[#1]{\color{black}\ref*{#1}}}
%\def\mpageref#1{\hyperref[#1]{\color{black}\pageref*{#1}}}
% Approach number 2
\def\mref#1{\hypersetup{linkcolor=black}\ref{#1}}
\def\mpageref#1{\hypersetup{linkcolor=black}\pageref{#1}}

\begin{document}
\begin{equation}
1+K_1K_2\frac{(s+2)^2}{(s+10)(s+100)(s^2+3.535s+6.25)}=0
\label{eq:part_b_characteristic_eq}
\end{equation}
\begin{table}[h!]
\begin{center}
\begin{tabular}{c|l}
$s_n$ & pole\\\hline
$s_1$ & $-100 + 0i$\\
$s_2$ & $-10 + 0i$\\
$s_3$ & $-1.77 + 1.77i$\\
$s_4$ & $-1.77 - 1.77i$\\
\end{tabular}
\end{center}
\caption{Pole values of the system from equation~\eqref{eq:part_b_characteristic_eq}}
\label{tab:poles_from_characteristic_eq_partb}
\end{table}
A citation from is~\mref{eq:part_b_characteristic_eq} on~\mpageref{eq:part_b_characteristic_eq}.
\end{document}

姆韦

相关内容