| 1 | # spotxcolor Package |
| 2 | |
| 3 | **LaTeX: Modern Spot Color Support for the `xcolor` package** |
| 4 | |
| 5 | This package provides robust spot color (e.g., DIC, PANTONE) support for the `xcolor` package across all major TeX engines. It resolves structural PDF issues found in the legacy `spotcolor` package and provides full spot color output for all engines including `dvipdfmx` (which is not supported by the `colorspace` package). |
| 6 | |
| 7 | * **Supported major drivers:** `pdftex`, `luatex`, `dvipdfmx` (including `ptex`/`uptex`), `xetex` |
| 8 | |
| 9 | ## Features |
| 10 | |
| 11 | - **Native `xcolor` Integration:** Use spot colors exactly like standard colors (`\textcolor{DIC161s!50}{text}`, `\pagecolor{DIC161s}`). All standard xcolor commands produce true PDF Separation color space operators on all engines. |
| 12 | - **Universal Engine Compatibility:** Fully supports `pdfLaTeX`, `LuaLaTeX`, `XeLaTeX`, and `(u)pLaTeX + dvipdfmx`. |
| 13 | - **Advanced Graphics Support:** Works flawlessly with complex `TikZ` and `PGF` environments. The package patches PGF driver macros and pattern primitives to emit true spot color PDF operators, fully supporting: |
| 14 | - Fill and stroke separation (independent spot color operators for fill/stroke). |
| 15 | - Uncolored patterns (`patterns` and `patterns.meta`) with spot color via `[/Pattern [/Separation ...]]` color spaces. |
| 16 | - Fadings (transparency masks) and blend modes (e.g., multiply). |
| 17 | - **Decorations:** Seamlessly integrates with `colortbl` (zebra-striped tables) and `tcolorbox` (frames, backgrounds, shadows). |
| 18 | - **pdfmanagement Compatibility:** Automatically detects when pdfmanagement (`l3pdf`) is active (i.e., `\DocumentMetadata{}` is used). No manual configuration is needed — spot colors work transparently with both traditional and pdfmanagement-based workflows. |
| 19 | |
| 20 | ### Limitations |
| 21 | |
| 22 | - **Shadings (gradients):** PGF generates Shading dictionary objects with a hardcoded `/DeviceRGB` color space. The color values are frozen into the PDF object at creation time, so spotxcolor cannot intercept them. |
| 23 | - **Non-proportional color mixes** (e.g., `DIC161s!80!black`): These produce CMYK values that are not a simple scalar multiple of the base spot color, so they correctly fall back to CMYK. |
| 24 | |
| 25 | See `spotxcolor.pdf` for a full feature/limitation summary table. |
| 26 | |
| 27 | ## Requirements |
| 28 | |
| 29 | * A modern [TeX Live](https://www.tug.org/texlive/) environment (requires an up-to-date `expl3`/`l3kernel`) |
| 30 | * `xcolor` and `iftex` packages |
| 31 | |
| 32 | ## Installation |
| 33 | |
| 34 | Copy `spotxcolor.sty` to your local TeX tree: |
| 35 | `$TEXMF/tex/latex/spotxcolor/` |
| 36 | |
| 37 | ## Usage |
| 38 | |
| 39 | Load the `spotxcolor` package. It will automatically load `xcolor` and detect your engine driver. |
| 40 | |
| 41 | ```latex |
| 42 | \usepackage{spotxcolor} |
| 43 | |
| 44 | % Define DIC 161 |
| 45 | % \definespotcolor{<latex-name>}{<pdf-name>}{<cmyk-values>} |
| 46 | \definespotcolor{DIC161s}{DIC 161s*}{0, 0.64, 1, 0} |
| 47 | |
| 48 | \begin{document} |
| 49 | \sffamily\bfseries |
| 50 | % All standard xcolor commands produce true spot color output: |
| 51 | \textcolor{DIC161s}{100\% Spot Color} |
| 52 | \textcolor{DIC161s!50}{50\% Tinted Spot Color} |
| 53 | \pagecolor{DIC161!10} |
| 54 | |
| 55 | % Low-level command for direct PDF literal injection: |
| 56 | \SpotColor{DIC161s}{1.0} |
| 57 | This is 100% DIC 161. |
| 58 | \end{document} |
| 59 | ``` |
| 60 | |
| 61 | ### Note for `(u)pLaTeX` users |
| 62 | If you compile your document with `platex` or `uplatex` and generate a PDF via `dvipdfmx`, you **must** specify the `dvipdfmx` driver option globally in your document class (e.g., `\documentclass[dvipdfmx]{article}`). Otherwise, modern `expl3` and `xcolor` will default to the `dvips` driver, and the spot colors will not be generated correctly. |
| 63 | |
| 64 | ## Backward Compatibility |
| 65 | You can easily reuse your existing code and color dictionaries written for the legacy `spotcolor` package. Commands like `\AddSpotColor`, `\NewSpotColorSpace`, and `\SetPageColorSpace` are perfectly emulated. |
| 66 | |
| 67 | ## License |
| 68 | |
| 69 | This package is licensed under the conditions of the LaTeX Project Public License, either version 1.3c of this license or any later version. |
| 70 | |
| 71 | -------------------- |
| 72 | |
| 73 | Munehiro Yamamoto |
| 74 | [https://github.com/munepi](https://github.com/munepi) |