In mathNotes.cls, I have this code:cls \AtBeginDocument{ \pagecolor{black} \color{white} }
But the white text color doesn't show up. I have to move \color{white} to be in 12.5 Chain ... Variable.tex for the white text to show. How can I fix this issue?
Side-note: the borders are not working, how do I fix that too? I was able to get this fixed
#How do I make text color work with .cls preambles?
1 messages · Page 1 of 1 (latest)
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{mathNotes}[2025/04/30 Custom class for math notes]
% Load the base class with default options
\LoadClass[preview, border=10pt, convert={density=300, outext=.pdf}, crop=false]{standalone}
% Always typeset math in display style
\everymath{\displaystyle}
% Standard mathematical typesetting packages
\RequirePackage[T1]{fontenc}
\RequirePackage[fixamsmath]{mathtools} % Extension to amsmath
\RequirePackage[cal=cm, scr=rsfs, frak=euler, bb=ams]{mathalpha}
\RequirePackage{cancel}
\RequirePackage[thinc]{esdiff}
\RequirePackage{physics} % Lots of useful shortcuts and macros
\RequirePackage{color}
% Common math commands
\let\ora\overrightarrow
\newcommand{\rad}{\mathrm{\,rad}}
\renewcommand{\deg}{^{\circ}}
\newcommand{\ihat}{\hat{\imath}}
\newcommand{\jhat}{\hat{\jmath}}
\newcommand{\khat}{\hat{k}}
\newcommand{\dom}{\mathrm{dom}}
\let\inf\infty
\newcommand{\lm}{\left| \left|}
\renewcommand{\rm}{\right| \right|}
\mathchardef\mathcomma=\mathcode`,
\mathcode`,="8000
{\catcode`,=\active \gdef,{\mathcomma\,}}
\renewcommand\familydefault{\sfdefault}
\newcommand{\f}{\mathrm{f}}
\newcommand{\dne}{\mathrm{DNE}}
\newcommand{\sgn}{\mathrm{sgn}}
\newcommand{\pro}{\mathrm{proj}}
\DeclareUnicodeCharacter{FE0E}{}
\DeclarePairedDelimiter\floor{\lfloor}{\rfloor}
\DeclarePairedDelimiter\ceil{\lceil}{\rceil}
\renewcommand{\div}{\divisionsymbol}
\usepackage[scaled]{helvet}
\renewcommand\familydefault{\sfdefault}
% Default document settings
\AtBeginDocument{
\pagecolor{black}
\color{white}
}
% Handle class options
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{standalone}}
\ProcessOptions\relax```
You need this in your class file
\newcommand{\globalcolor}[1]{%
\color{#1}\global\let\default@color\current@color
}
\AtBeginDocument{
\pagecolor{black}
\globalcolor{white}
}
That didnt work
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{mathNotes}[2025/04/30 Custom class for math notes]
% Load the base class with default options
\LoadClass[preview, border=10pt, convert={density=300, outext=.pdf}, crop=false]{standalone}
% Always typeset math in display style
\everymath{\displaystyle}
% Standard mathematical typesetting packages
\RequirePackage[T1]{fontenc}
\RequirePackage[fixamsmath]{mathtools} % Extension to amsmath
\RequirePackage[cal=cm, scr=rsfs, frak=euler, bb=ams]{mathalpha}
\RequirePackage{cancel}
\RequirePackage[thinc]{esdiff}
\RequirePackage{physics} % Lots of useful shortcuts and macros
\RequirePackage{color}
% Common math commands
\newcommand{\lm}{\left| \left|}
\renewcommand{\rm}{\right| \right|}
\mathchardef\mathcomma=\mathcode`,
\mathcode`,="8000
{\catcode`,=\active \gdef,{\mathcomma\,}}
\renewcommand\familydefault{\sfdefault}
\newcommand{\f}{\operatorname{f}}
\newcommand{\dne}{\mathrm{DNE}}
\newcommand{\sgn}{\mathrm{sgn}}
\newcommand{\pro}{\operatorname{proj}}
\let\ora\overrightarrow
\newcommand{\rad}{\mathrm{\,rad}}
\renewcommand{\deg}{^{\circ}}
\newcommand{\ihat}{\hat{\imath}}
\newcommand{\jhat}{\hat{\jmath}}
\newcommand{\khat}{\hat{k}}
\newcommand{\dom}{\operatorname{dom}}
\let\inf\infty
% Sets
\newcommand{\bR}{\mathbb{R}}
\newcommand{\bN}{\mathbb{N}}
\newcommand{\bZ}{\mathbb{Z}}
\newcommand{\bQ}{\mathbb{Q}}
\newcommand{\bC}{\mathbb{C}}
\DeclareUnicodeCharacter{FE0E}{}
\DeclarePairedDelimiter\floor{\lfloor}{\rfloor}
\DeclarePairedDelimiter\ceil{\lceil}{\rceil}
\renewcommand{\div}{\divisionsymbol}
\usepackage[scaled]{helvet}
\renewcommand\familydefault{\sfdefault}
% Default document settings
\newcommand{\globalcolor}[1]{%
\color{#1}\global\let\default@color\current@color
}
\AtBeginDocument{
\pagecolor{black}
\globalcolor{white}
\color{white}
}
% Handle class options
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{standalone}}
\ProcessOptions\relax```
\documentclass{mathNotes}
\begin{document}
\section*{Chain Rule}
Let $f0$ be a function of $x$ and $y$ (and $z$). \\
...```