TeX - LaTeX Asked by karkraeg on July 8, 2021
I am trying to use a variable I define with newcommand
in a tex file (profile
) in an if-else loop to define a color (main_color
) in the style-file I am using. So when profile
is np
main_color
should be Hex Code 2A4A97
, else it should be a5003b
. I tried
ifthenelse{equal{profile}{np}}
{definecolor{main_color}{HTML}{2A4A97}}
{definecolor{main_color}{HTML}{a5003b}}
but then I’m getting the following error: ! Undefined control sequence. <argument> profile
The MWE is as follows:
mwe.tex
documentclass[a4paper]{scrartcl}
usepackage{blindtext}
usepackage{mwe}
newcommand{profile}{detokenize{np}}
begin{document}
customtitlepage
section{Section One}
blindtext
end{document}
The style used is this (mwe.sty):
ProvidesPackage{mwe}
RequirePackage[ngerman]{babel}
RequirePackage[margin=2.5cm]{geometry}
RequirePackage[]{xcolor}
RequirePackage{fontspec}
RequirePackage{ifthen}
% ---------------- Colors
definecolor{main_color}{HTML}{2A4A97}
% ifthenelse{equal{profile}{np}}
% {definecolor{main_color}{HTML}{2A4A97}}
% {definecolor{main_color}{HTML}{a5003b}}
% ---------------- Titlepage Definition
defcustomtitlepage{
begin{titlepage}
raggedleft
{huge Title vspace{0.25cm}}
{color{main_color}rule{12cm}{3pt}} % Thick horizontal rule
vspace{2.5cm}
raggedright
{huge profile vspace{0.25cm}}
{color{main_color}rule{9.3cm}{3pt}} % Second Thick horizontal rule
vfill
centering
Text
vfill
vspace{0.5cm}
{color{main_color}rule{textwidth}{3pt}}
vspace{1cm}
end{titlepage}
}
The tex files are generated automatically and profile
is used in several other places in the style, so I’d like to use it for this purpose as well.
Thanks!
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP