
我正在嘗試創建我的第一個基於 KOMA 的自訂乳膠類,但我不知道如何在該上下文中定義/使用自訂顏色。
我的目標是擁有一個彩色標題。問題是,當我使用自訂顏色時,標題(或任何其他文字)變得不可見(但它在那裡!)。
我幾個小時以來一直在尋找這個問題的解決方案,但沒有成功,我不知道這裡可能出了什麼問題。
這是一個最小的工作範例:
% File: 'myclass.cls'
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{myclass}
\RequirePackage{xcolor}
\definecolor{mycolor}{rgb}{40,40,40}
\LoadClass{scrartcl}
\renewcommand*{\maketitle}{
\begin{center}
\Large
\color{mycolor}
\@title % <-- invisible
\end{center}
\pagebreak
}
\endinput
% File: textfile.tex
\documentclass{myclass}
\usepackage{lipsum}
\title{mytitle}
\begin{document}
\maketitle
\lipsum[1]
\end{document}
謝謝。
答案1
使用 RGB(接受 0 到 255 之間的參數)而不是 rgb(需要 0 到 1 之間的參數)。看第 10 頁,xcolor 手冊,v2.11。