📄 ctextemp_texpower.sty
字号:
\egroup\egroup
\begingroup
\CT@setup
\CT@column@color
\CT@row@color
\CT@do@color
\endgroup
\@tempdima\ht\z@
\advance\@tempdima\minrowclearance
\vrule\@height\@tempdima\@width\z@
\unhbox\z@}%
\prepnext@tok}%
}
{%
\def\@classz{\@classx
\@tempcnta \count@
\prepnext@tok
\@addtopreamble{\ifcase \@chnum
\hfil
\d@llarbegin
\insert@column
\d@llarend \hfil \or
\hskip1sp\d@llarbegin \insert@column \d@llarend \hfil \or
\hfil\hskip1sp\d@llarbegin \insert@column \d@llarend \or
\@startvcenter
\@startpbox{\@nextchar}\insert@column \@endpbox $\or % $
\vtop \@startpbox{\@nextchar}\insert@column \@endpbox \or
\vbox \@startpbox{\@nextchar}\insert@column \@endpbox
\fi}\prepnext@tok}%
}
\def\@startvcenter{\everymath{}$\everymath{\color{mathcolor}}\vcenter}% $
\expandafter\def\expandafter\@mkpream\expandafter#\expandafter1%
\expandafter{%
\expandafter\let\expandafter\@startvbox\expandafter\relax
\@mkpream{#1}}
}
{%
\def\@tabular{\leavevmode \hbox \bgroup \everymath{}$\everymath{\color{mathcolor}}\let\@acol\@tabacol
\let\@classz\@tabclassz
\let\@classiv\@tabclassiv \let\\\@tabularcr\@tabarray% $
}%
}
\long\def\@iiiparbox#1#2[#3]#4#5{%
\leavevmode
\@pboxswfalse
\setlength\@tempdima{#4}%
\@begin@tempboxa\vbox{\hsize\@tempdima\@parboxrestore#5\@@par}%
\ifx\@empty#2\else\ifx\relax#2\else
\setlength\@tempdimb{#2}%
\def\@parboxto{to\@tempdimb}%
\fi\fi
\if#1b\vbox
\else\if #1t\vtop
\else\ifmmode\vcenter
\else\@pboxswtrue \everymath{}$\everymath{\color{mathcolor}}\vcenter
\fi\fi\fi
\@parboxto{\let\hss\vss\let\unhbox\unvbox
\csname bm@#3\endcsname}%
\if@pboxsw \m@th$\fi
\@end@tempboxa}
\let\o@textsuperscript@TP=\textsuperscript
\def\textsuperscript#1{{\everymath{}\o@textsuperscript@TP{\everymath{\color{mathcolor}}#1}}}%
}% matches \ifthenelse{\boolean{colormath@TP}}{% Yes.
{% No; keep original definition.
\let\origmath=\ensuremath% \origmath needs to have a sensible definition.
}
%-----------------------------------------------------------------------------------------------------------------------
% New highlighting and emphasis commands. Most of them have a sensible alternative definition if the colorhighlight
% option is not given.
% \code{<text>} will display <text> in a `code-like' style (for shell commands or macro names).
% \codeswitch switches to the style used by \code, for use e.g. in verbatim environments.
\ifthenelse{\boolean{colorhighlight@TP}}% Color highlighting enabled?
{% Yes; code is displayed typewriter-style, bold and in a special color.
\DeclareRobustCommand{\code}[1]{\textcolor{codecolor}{\textbf{\texttt{#1}}}}%
\DeclareRobustCommand{\codeswitch}{\color{codecolor}\bfseries\ttfamily}%
}
{% No; code is displayed just in typewriter-style and bold.
\DeclareRobustCommand{\code}[1]{\textbf{\texttt{#1}}}%
\DeclareRobustCommand{\codeswitch}{\bfseries\ttfamily}%
}
% \macroname{<text>} acts like \code, but adds a backslash in front.
\newcommand{\macroname}[1]{\code{\textbackslash#1}}
% \commandapp[<opt>]{<name>}{<arg>} displays a macro with an argument. <name> is the macro name, <opt> is an optional
% argument, <arg> is the macro argument. Note that only one pair of braces is added for <arg>; for several arguments,
% \}\{ needs to be used inside <arg> to separate arguments.
\newcommand{\commandapp}[3][]{\code{\macroname{#2}\ifthenelse{\equal{#1}{}}{}{[#1]}\{#3\}}}
% \carg{<text>} displays a `symbolic argument', i.e. <text> in code style enclosed in pointy braces.
\newcommand{\carg}[1]{\code{\origmath{\left<\code{#1}\right>}}}
% \underline{<text>} emphasises <text> using a special color if the colorhighlight option is given and by boldfacing
% otherwise.
\ifthenelse{\boolean{colorhighlight@TP}}% Color highlighting enabled?
{% Yes;
\DeclareRobustCommand{\underl}{\textcolor{underlcolor}}% Use color to highlight.
}
{% No;
\DeclareRobustCommand{\underl}{\textbf}% Use bold face.
}
% \concept{<text>} emphasises <text> using a special color if the colorhighlight option is given and by boldfacing
% otherwise. To be used for emphasizing names of (new) concepts.
\ifthenelse{\boolean{colorhighlight@TP}}% Color highlighting enabled?
{% Yes;
\DeclareRobustCommand{\concept}{\textcolor{conceptcolor}}% Use color to highlight.
}
{% No;
\DeclareRobustCommand{\concept}{\textbf}% Use bold face.
}
% \inactive{<text>} emphasises <text> using a special color if the colorhighlight option is given. Nothing is done if
% the option is not given. To be used for `de-emphasizing' things not currently of interest.
\ifthenelse{\boolean{colorhighlight@TP}}% Color highlighting enabled?
{% Yes;
\DeclareRobustCommand{\inactive}{\textcolor{inactivecolor}}% Use color to highlight.
}
{% No;
\DeclareRobustCommand{\inactive}{\monochromeinactive}% Use monochrome default.
}
\providecommand{\monochromeinactive}{}% What should \inactive do if colors can't be used? We provide a hook for
% user definitions.
% \present[<opt>]{<text>} puts its argument into an \fbox with coloured background.
% If <opt> is given, it is added to the left of the box without taking any space, i.e. it will overlap text to the left
% of the box. This addition is useful mainly for adding `constraints' to things presented in a description or center
% environment.
\ifthenelse{\boolean{colorhighlight@TP}}% Color highlighting enabled?
{% Yes; use a colored box.
\newcommand{\present}[2][]{\leavevmode\llap{\textbf{\footnotesize#1}\,}\fcolorbox{textcolor}{presentcolor}{#2}}%
\newcommand{\mkpbox@TP}[1]{\fcolorbox{presentcolor}{presentcolor}{#1}}% Internal macro for use by \presentbox.
}
{% No; use an \fbox.
\newcommand{\present}[2][]{\leavevmode\llap{\textbf{\footnotesize#1}\,}\fbox{#2}}%
\newcommand{\mkpbox@TP}[1]{\fbox{#1}}%
}
% \begin{presentbox} <stuff> \end{presentbox}
% creates a coloured patch of width \linewidth with a minipage containing <stuff> inside. If the colorhighlight option
% is not given, an \fbox containing the minipage is created.
\newsavebox{\pbox@TP}% Container for the minipage to be boxed.
\newenvironment{presentbox}%
{%
\par\smallskip% First a small space to separate the area from preceding text.
\begin{lrbox}{\pbox@TP}% Save the contents in a minipage inside \pbox@TP.
\noindent
\begin{minipage}{\linewidth-2\fboxsep-2\fboxrule}% Reduce the width of the minipage to leave space for the frame.
\replacecolor{presentcolor}{pagecolor}% If \present is used inside the colored area...
}%
{%
\end{minipage}
\end{lrbox}%
\noindent\mkpbox@TP{\usebox{\pbox@TP}}% This typesets the saved minipage inside the coloured area.
\smallskip% A small space to separate the area from succeding text.
\par
}
%=======================================================================================================================
% Structured rules, box and page backgrounds.
%-----------------------------------------------------------------------------------------------------------------------
% Structured rules.
% Some configurable defaults for rules and box backgrounds.
% Default number of stripes for gradient rules and box backgrounds.
\newcommand{\rulestripes}{10}
% Default stripe overlap for avoiding `gaps' in color gradients.
\newcommand{\stripeoverlap}{.15pt}
% Default gradient progression for rules and box backgrounds (single gradients or first part of double gradients).
\newcommand{\rulefirstgradprogression}{1}
% Default gradient progression for rules and box backgrounds (second part of double gradients).
\newcommand{\rulesecondgradprogression}{1}
% Default position of the `middle' color of a double gradient.
\newcommand{\rulegradmidpoint}{.5}
% The following are used internally when making color gradients.
\newcounter{stripe@TP}
\newcounter{stripes@TP}
\newcommand{\firstgradprogression@TP}{1}
\newcommand{\secondgradprogression@TP}{1}
\newcounter{gradprogression@TP}
\newcommand{\gradmidpoint@TP}{.5}
% Special versions of \mkfactor which apply gradient progressions.
\newcommand{\mkgradfirstfactor@TP}{\mkgradfactor@TP\firstgradprogression@TP}
\newcommand{\mkgradsecondfactor@TP}{\mkgradfactor@TP\secondgradprogression@TP}
\newcommand{\mkgradfactor@TP}[3]% Calculate a factor modified by a `progression' parameter.
{%
\mkfactor{#2}{#3}% Calculate the unmodified factor.
\setcounter{gradprogression@TP}{#1}% Factor definition may contain a calc-expression.
\ifthenelse{\value{gradprogression@TP}=1}{}% Progression value 1 is neutral.
{%
\ifthenelse{\value{gradprogression@TP}<0}% `Negative' progression?
{% Yes.
\@tempcnta-\value{gradprogression@TP}\relax% Complement progression wrt 0.
\mkfactor{#2}{1-1pt*\real{#2}}% Complement factor definition wrt 1pt.
}
{\@tempcnta\value{gradprogression@TP}\relax}% No; Use progression as given.
\whiledo{\the\@tempcnta>1}% Calculate (factor definition)^(progression).
{\advance\@tempcnta by -1\relax\mkfactor{#2}{\real{#2}*\real{#2}}}%
\ifthenelse{\value{gradprogression@TP}<0}% `Negative' progression?
{% Yes.
\mkfactor{#2}{1-1pt*\real{#2}}% Complement result wrt 1pt.
}
{}%
}%
}
% \vgradrule[<stripes>][<startmodel>]{<startcolor>}[<endmodel>]{<endcolor>}[<raise>]{<width>}{<height>} creates a
% rule-like object consisting of a vertical color gradient composed of horizontal stripes.
%
% The topmost stripe has color {<startcolor>}, the bottommost stripe has color {<endcolor>}. Inbetween, color changes
% gradually from top to bottom.
% The colors are specified exactly as for the \color command: if the optional argument <startmodel> is given,
% <startcolor> contains an explicit definition of a color from model <startmodel>, otherwise <startcolor> is the name of
% a defined color. The same holds for <endmodel> and <endcolor>.
%
% The arguments [<raise>]{<width>}{<height>} work exactly as for the \rule command.
%
% The optional argument <stripes>, if given, should contain a (calc expression for a) number specifying the number of
% stripes. If <stripes> is not given, the default is the content of \rulestripes (default 10).
%
% There is one more parameter which is not given as an argument. The control sequence \rulefirstgradprogression should
% expand to an (calc expression for an) integer. This value (default 1) controls the `order' of progression from
% <startcolor> to <endcolor>.
% The default value 1 means linear progression. 2 means quadratic progression, i.e. color values `nearer' to <endcolor>
% are reached `later' (the square of 0.5, for instance, is 0.25, i.e. in the geometric middle point of the rule
% produced, the color gradient will have traveled only to one quarter of the `distance' between <startcolor> and
% <endcolor>).
% 3 means cubic progression and so on. 0 and -1 mean the same as 1. -2 means quadratic progression ``from bottom to
% top'', i.e. color values `nearer' to <endcolor> are reached `earlier', and analogously for -3, -4, ...
%
% If you wish to give the second optional argument but not the first, just write \vgradrule[][<startmodel>]...
%
\newcommand{\vgradrule}[1][]% Pick up first optional argument: [<stripes>]
{%
\let\firstgradprogression@TP=\rulefirstgradprogression% Use progression parameter for rules.
\ifthenelse{\equal{#1}{}}% First optional argument given?
{\setcounter{stripes@TP}{\rulestripes}}% No; use default value.
{\setcounter{stripes@TP}{#1}}% Yes.
\vgradrule@TP% Pick up [<startmodel>]{<startcolor>}.
}
\newcommand{\vgradrule@TP}[2][]% Pick up next pair of arguments: [<startmodel>]{<startcolor>}.
{%
\ifthenelse{\equal{#1}{}}% <startmodel> given?
{\replacecolor{startcolor@TP}{#2}}% No
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -