% Set document class to article with 11pt font size and A4 paper
\documentclass[11pt, a4paper]{article}

% Font and input encoding for proper character rendering
\usepackage[T1]{fontenc} % Uses T1 font encoding
\usepackage[utf8]{inputenc} % Allows UTF-8 encoded characters
\usepackage[english]{babel} % English hyphenation and language rules

% Page layout settings
\usepackage{geometry} % Package to adjust page margins
\geometry{margin=3cm} % Sets all margins to 3 cm

% Load xcolor for coloring text and code blocks in this manual
\usepackage{xcolor} 

% Setup hyperlinks in the PDF
\usepackage{hyperref}
\hypersetup{
    colorlinks=true,       % Colors the text of the links instead of drawing boxes
    linkcolor=blue,        % Color for internal links (TOC)
    urlcolor=blue,         % Color for external URLs
    pdftitle={printcolormanager Documentation}, % PDF metadata title
    pdfauthor={Zsolt Bihari}  % PDF metadata author (Change this to your name!)
}

% Code listing configuration for showing LaTeX examples
\usepackage{listings}
\lstset{
    language=[LaTeX]TeX,           % Defines the language as LaTeX
    basicstyle=\ttfamily\small,    % Monospaced font for code
    backgroundcolor=\color{gray!10},% Light gray background for code blocks
    frame=single,                  % Draws a frame around the code
    keywordstyle=\color{blue},     % LaTeX commands in blue
    commentstyle=\color{green!60!black}, % Comments in dark green
    stringstyle=\color{orange}     % Strings in orange
}

% Title page information
\title{\textbf{The \texttt{printcolormanager} Package}\\ \large User Manual}
\author{Zsolt Bihari \\ \href{mailto:info@tengerikajak.net}{info@tengerikajak.net}} % Change to your details!
\date{Version 1.0 -- \today} % Automatically inserts the current date

% Begin the actual document
\begin{document}

\maketitle % Generates the title page based on \title, \author, \date

% Abstract environment for a short summary
\begin{abstract}
The \texttt{printcolormanager} is a LaTeX package providing an automated and unified color management workflow for print and digital publications. It allows users to compile the same document into CMYK (prepress), RGB (screen), or Grayscale formats simply by changing a single package option.
\end{abstract}

\tableofcontents % Generates the Table of Contents
\vspace{2em}     % Adds vertical space after the TOC

% Section: Introduction
\section{Introduction}
While LaTeX's built-in \texttt{xcolor} package is powerful, handling different color spaces consistently for professional prepress workflows can be challenging. Relying on mathematical RGB-to-CMYK conversions often results in "muddy" or inaccurate printed colors. 

The \texttt{printcolormanager} solves this by defining a global target color space and using dedicated macros to explicitly set exact values for each color space, ensuring perfect color fidelity across different media.

% Section: Loading the package
\section{Loading the Package and Options}
Load the package in your preamble (after \verb|\documentclass|) with the desired target color space option:

% lstlisting environment to display code
\begin{lstlisting}
\usepackage[CMYK]{printcolormanager}
\end{lstlisting}

Supported options include:
\begin{itemize}
    \item \texttt{CMYK} or \texttt{cmyk}: Four-color print output.
    \item \texttt{RGB} or \texttt{rgb}: Three-color digital/screen output.
    \item \texttt{gray}: Continuous grayscale output (0.0 to 1.0).
    \item \texttt{GRAY}: Discrete grayscale output (integer scale).
    \item \texttt{HSB}: Hue, Saturation, Brightness.
    \item \texttt{Lab}: CIE Lab color space.
\end{itemize}

% Section: Defining custom colors
\section{Defining Custom Colors}
The core of this package is the \verb|\definePrintColor| macro. It allows you to specify exact, manual values for a single color across all supported color spaces.

\subsection{Syntax}
\begin{lstlisting}
\definePrintColor{Name}{RGB}{CMYK}{GRAY}{HSB}{Lab}
\end{lstlisting}

\textbf{Example for a custom brand color:}
\begin{lstlisting}
\definePrintColor{BrandRed}{210, 40, 40}{0.05, 0.95, 0.90, 0.0}%
{0.55}{0, 80, 80}{50, 65, 45}
\end{lstlisting}
When compiling, the package checks the global option (e.g., \texttt{[CMYK]}) and automatically applies the specific values (in this case \texttt{0.05, 0.95, 0.90, 0.0}) without relying on inaccurate automatic conversions.

% Section: Prepress Blacks
\section{Pure Black vs. Rich Black}
In professional prepress, typographic text black must be separated from background black. The package provides two predefined macros:
\begin{itemize}
    \item \verb|\textcolor{PureBlack}{text}|: Uses \texttt{0.0, 0.0, 0.0, 1.0} in CMYK. Ideal for thin lines and text to prevent registration issues on the press.
    \item \verb|\textcolor{RichBlack}{text}|: Uses \texttt{0.40, 0.0, 0.0, 1.0} in CMYK. Adds cyan to create a deeper, darker black for large printed areas.
\end{itemize}


\subsection{Mandatory Parameters and Empty Values}
The \verb|\definePrintColor| macro strictly expects \textbf{six parameters}. You cannot omit any curly braces; doing so will result in a LaTeX compilation error (\textit{Runaway argument}).

If you do not know or do not wish to specify certain values (for example, HSB or Lab), you must still provide the empty braces. You can either use fallback values or leave the brackets empty:

\begin{lstlisting}
% Correct usage with empty HSB and Lab values:
\definePrintColor{ExampleColor}{255,0,0}{0,1,1,0}{0.5}{}{}
\end{lstlisting}

\textbf{Warning:} If you leave a parameter completely empty (e.g., \texttt{\{\}}), ensure that you never compile the document using the corresponding global package option (in this example, \texttt{[HSB]} or \texttt{[Lab]}). Passing an empty value to the underlying \texttt{xcolor} engine will cause an error! For maximum safety, it is recommended to provide valid numerical values for all six parameters.

\end{document} % Ends the document
