📄 ctextemp_texpower.sty
字号:
\newboolean{whitebackground@TP}
\setboolean{whitebackground@TP}{true}% This is the default.
\DeclareOption{whitebackground}
{\setboolean{TPcolor}{true}\setboolean{whitebackground@TP}{true}}
% The option lightbackground selects standard colors for light (but not white) backgrounds.
\newboolean{lightbackground@TP}
\DeclareOption{lightbackground}
{\setboolean{TPcolor}{true}\setboolean{lightbackground@TP}{true}}
% The option blackbackground selects standard colors for black backgrounds.
\newboolean{blackbackground@TP}
\DeclareOption{blackbackground}
{\setboolean{TPcolor}{true}\setboolean{blackbackground@TP}{true}}
% The option darkbackground selects standard colors for dark (but not black) backgrounds.
\newboolean{darkbackground@TP}
\DeclareOption{darkbackground}
{\setboolean{TPcolor}{true}\setboolean{darkbackground@TP}{true}}
%-----------------------------------------------------------------------------------------------------------------------
% Load the config file for default options.
\InputIfFileExists{tpoptions.cfg}{}{}% Allows setting default values for options.
%-----------------------------------------------------------------------------------------------------------------------
% Process options.
\ProcessOptions
%-----------------------------------------------------------------------------------------------------------------------
% General option-driven initialization.
% If the verbose option is set, we give a lot of context information when an error is raised.
\ifthenelse{\boolean{verbose@TP}}{\setcounter{errorcontextlines}{10000}}{}
%-----------------------------------------------------------------------------------------------------------------------
% Driver-specific defaults.
% We provide a switch which (hopefully) allows to distinguish whether postscript specials (as used by PSTricks) can be
% used safely or not.
\newboolean{psspecialsallowed}
\setboolean{psspecialsallowed}{true} % optimistic default
% The switch \ifpdf is to determine whether pdfLaTeX is being run and outputting pdf, using Heiko Oberdiek's faultproof
% pdf detector:
\IfFileExists{ifpdf.sty}
{%
\RequirePackage{ifpdf}%
}
{%
\@ifundefined{pdftrue}
{%
\expandafter\newif\csname ifpdf\endcsname
\ifx\pdfoutput\undefined
\else
\ifx\pdfoutput\relax
\else
\ifcase\pdfoutput
\else
\pdftrue
\fi
\fi
\fi
}{}%
}
\ifpdf\setboolean{psspecialsallowed}{false}\fi
%-----------------------------------------------------------------------------------------------------------------------
% Class-specific defaults.
% The following switches centering of slides off for the slides document class because this would disturb dynamic
% building of slides.
\@ifclassloaded{slides}% Using the slides document class?
{%
\ifthenelse{\boolean{display}}% Dynamic features enabled?
{\let\@topfil\relax}% Then don't center slides.
{}%
}
{}
%=======================================================================================================================
% Execute Font options.
\ifthenelse{\boolean{sans@TP}}% Option sans given?
{%
\renewcommand{\familydefault}{\sfdefault}
}{}
\ifthenelse{\boolean{slifonts@TP}}% Option slifonts given?
{%
\PackageWarning{texpower}
{Option slifonts is obsolete.\MessageBreak Loading tpslifonts package instead}%
\RequirePackage{tpslifonts}
}
{}
%=======================================================================================================================
% Some registers and macros for general use throughout texpower.sty.
\newcounter{tmpcnta@TP}
\newcounter{tmpcntb@TP}
\newlength{\tempdima@TP}
\newlength{\tempdimb@TP}
\newbox\tempbox@TP
\newboolean{carryon@TP}
% These are needed for calculating the size of the page background box.
\newcommand{\TPpagewidth}{\strip@pt\paperwidth truept}
\newcommand{\TPpageheight}{\strip@pt\paperheight truept}
% \AtBeginDocument
% {%
% \edef\TPpagewidth{\strip@pt\paperwidth truept}%
% \edef\TPpageheight{\strip@pt\paperheight truept}%
% }
% \mkfactor{<cs>}{<exp>} is a helper command for automatically generating the fixed point numbers between 0 and 1
% which are employed by the color calculation commands. <exp> can be anything which can stand behind * in calc
% (for instance: \value{counter}/\value{maxcounter} or \ratio or whatever). <cs> should be a valid macro name. <exp>
% is converted into a fixed-point representation which is then assigned to <cs>.
\newcommand{\mkfactor}[2]%
{\setlength{\tempdima@TP}{1pt*#2}\edef#1{\strip@pt\tempdima@TP}}
% Make a string representation of a length expression.
\newcommand{\mklength@TP}[2]
{\setlength{\tempdima@TP}{#2}\edef#1{\the\tempdima@TP}}
\newcommand{\mklength}{}
\let\mklength\mklength@TP
%=======================================================================================================================
% Color management, color emphasis and highlighting.
%-----------------------------------------------------------------------------------------------------------------------
% Initialization.
\ifthenelse{\boolean{TPcolor}}{\RequirePackage{color}}{}% If we are to use colors, we need the color package.
%-----------------------------------------------------------------------------------------------------------------------
% Color management kernel.
\ifthenelse{\boolean{TPcolor}}% Only if TeXPower's color management is active.
{% Yes.
\let\setcolor@TP=\color% A hook which can be defined otherwise to turn off colors.
% Overload \definecolor to store a `driver-independent' copy of the color definition for later use by \colorbetween
% and relatives.
\let\o@definecolor@TP=\definecolor% Overload \definecolor.
\def\definecolor#1#2#3% TeXPower's own definition of \definecolor.
{%
\o@definecolor@TP{#1}{#2}{#3}% Execute original definition.
\expandafter\edef\csname colordef@TP@#1\endcsname% Make a copy of the color definition.
{\csname processcolor@TP@#2\endcsname{#3}}%
}%
% Repeat color.sty's standard color definitions to make the original definitions available to TeXPower.
% begin excerpt from color.sty
\@ifundefined{c@lor@namefile}{}{\input{\c@lor@namefile}}
\ifx\color@gray\@undefined
\ifx\color@rgb\@undefined
\else
\definecolor{black}{rgb}{0,0,0}
\definecolor{white}{rgb}{1,1,1}
\fi
\else
\definecolor{black}{gray}{0}
\definecolor{white}{gray}{1}
\fi
\ifx\color@rgb\@undefined\else
\definecolor{red}{rgb}{1,0,0}
\definecolor{green}{rgb}{0,1,0}
\definecolor{blue}{rgb}{0,0,1}
\fi
\ifx\color@cmyk\@undefined\else
\definecolor{cyan}{cmyk}{1,0,0,0}
\definecolor{magenta}{cmyk}{0,1,0,0}
\definecolor{yellow}{cmyk}{0,0,1,0}
\fi
% end excerpt from color.sty
% Commands for calculating new colors.
\newcommand{\interpolate@TP}[3]% Calculate the weighted average between two fixed point values.
{%
\setlength{\tempdima@TP}{1pt-#1pt}% Calculate the second factor for the weighted average.
\edef\secondfactor@TP{\strip@pt\tempdima@TP}%
\setlength{\tempdima@TP}{#2pt*\real{#1}+#3pt*\real{\secondfactor@TP}}% Calculate the weighted average.
\ifthenelse{\lengthtest{\tempdima@TP<0pt}}% Bound the result to the interval [0,1] (just in case the first
{\setlength{\tempdima@TP}{0pt}}% factor was not from [0,1]).
{\ifthenelse{\lengthtest{\tempdima@TP>1pt}}{\setlength{\tempdima@TP}{1pt}}{}}%
\edef\result@TP{\strip@pt\tempdima@TP}%
}
\def\interpolate@three@TP#1,#2,#3;#4,#5,#6;#7% Interpolate a three-piece color value.
{%
\interpolate@TP{#7}{#1}{#4}% First intermediary value.
\edef\newcolordef@TP{\result@TP,}% Store first value.
\interpolate@TP{#7}{#2}{#5}% Second intermediary value.
\edef\newcolordef@TP{\newcolordef@TP\result@TP,}% Store second value.
\interpolate@TP{#7}{#3}{#6}% Third intermediary value.
\edef\newcolordef@TP{\newcolordef@TP\result@TP}% Store third value.
}
\def\interpolate@four@TP#1,#2,#3,#4;#5,#6,#7,#8;#9% Interpolate a four-piece color value.
{%
\interpolate@TP{#9}{#1}{#5}% First intermediary value.
\edef\newcolordef@TP{\result@TP,}% Store first value.
\interpolate@TP{#9}{#2}{#6}% Second intermediary value.
\edef\newcolordef@TP{\newcolordef@TP\result@TP,}% Store second value.
\interpolate@TP{#9}{#3}{#7}% Third intermediary value.
\edef\newcolordef@TP{\newcolordef@TP\result@TP,}% Store third value.
\interpolate@TP{#9}{#4}{#8}% Fourth intermediary value.
\edef\newcolordef@TP{\newcolordef@TP\result@TP}% Store fourth value.
}
\def\convert@cmykvalue@rgbvalue@TP#1#2% Convert one color value from CMYK to rgb.
{%
\setlength{\tempdima@TP}{1pt-#1pt-#2pt}%
\ifthenelse{\lengthtest{\tempdima@TP<0pt}}{\setlength{\tempdima@TP}{0pt}}{}%
\edef\result@TP{\strip@pt\tempdima@TP}%
}%
\def\convert@cmyk@rgb@TP#1,#2,#3,#4;% Convert CMYK color to rgb.
{%
\convert@cmykvalue@rgbvalue@TP{#1}{#4}%
\edef\newcolordef@TP{\result@TP,}% Store first value.
\convert@cmykvalue@rgbvalue@TP{#2}{#4}%
\edef\newcolordef@TP{\newcolordef@TP\result@TP,}% Store second value.
\convert@cmykvalue@rgbvalue@TP{#3}{#4}%
\edef\newcolordef@TP{\newcolordef@TP\result@TP}% Store third value.
}
\def\convert@RGBvalue@rgbvalue@TP#1% Convert one color value from RGB to rgb.
{%
\setlength{\tempdima@TP}{#1pt/255}%
\edef\result@TP{\strip@pt\tempdima@TP}%
}%
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -