latex-homework/shortcuts/shortcuts.sty

322 lines
6.7 KiB
Plaintext
Raw Normal View History

2017-02-17 15:06:56 +00:00
%%%
%%%
2017-03-19 15:27:16 +00:00
%%% Extensions : shortcuts.sty
%%% Version : 1.0
%%% Date : 10/05/16
%%% Auteur : Jeff LANCE
2016-05-28 21:33:38 +00:00
%%% Notes : Cette extension peut demander l'ajout de certains packages.
%%% Il est conseillé de l'appeler dans un(e) classe/(package) appelant
%%% elle(lui)-même ces packages.
%%%
%%%
\NeedsTeXFormat{LaTeX2e}
2017-03-19 15:22:05 +00:00
\ProvidesPackage{shortcuts}[2016/05/16 Définitions de raccourcis vers des macros
existantes, v1.0]
2019-05-23 18:31:21 +00:00
2017-02-17 14:09:27 +00:00
\makeatletter
2019-05-23 18:31:21 +00:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2018-10-04 20:32:37 +00:00
%
%
% ENVIRONMENTS
%
%
2018-11-04 09:16:13 +00:00
2019-05-23 18:31:21 +00:00
%% itemize
%%
\newcommand{\bi}{\begin{itemize}}
\newcommand{\ei}{\end{itemize}}
2019-05-23 18:31:21 +00:00
%% enumerate
%%
\newcommand{\be}{\begin{enumerate}}
\newcommand{\ee}{\end{enumerate}}
2019-05-23 18:31:21 +00:00
%% descriptions
%%
\newcommand{\bd}{\begin{description}}
\newcommand{\ed}{\end{description}}
2019-11-12 20:38:21 +00:00
%% columns
%%
\newcommand{\bc}{\begin{columns}}
\newcommand{\ec}{\end{columns}}
2019-05-23 18:31:21 +00:00
%% questions
%%
\newcommand{\bq}{\begin{questions}}
\newcommand{\eq}{\end{questions}}
2020-06-21 20:42:38 +00:00
%% tasks
%%
2020-08-20 15:19:11 +00:00
\newcommand{\bt}{\begin{tasks}}
\newcommand{\et}{\end{tasks}}
2019-05-23 18:31:21 +00:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2016-05-28 21:20:44 +00:00
2016-05-28 21:33:38 +00:00
2019-05-23 18:31:21 +00:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2018-10-04 20:32:37 +00:00
%
%
% TEXT
%
%
2018-11-04 09:16:13 +00:00
%% positive skip.
%%
\NewDocumentCommand \pskip { G{.2} } {%
2019-11-17 18:15:17 +00:00
\vspace*{+#1cm}
}
%% negative skip.
%%
\NewDocumentCommand \nskip { G{.8} } {%
2019-11-17 18:15:17 +00:00
\vspace*{-#1cm}
}
2019-05-23 18:31:21 +00:00
%% another shortcut to whiting text.
%%
\NewDocumentCommand \ghost { } {%
\white
}
2019-05-23 18:31:21 +00:00
%% c'est-à-dire
%%
2016-08-11 16:20:46 +00:00
\NewDocumentCommand \cad { } {
{c'est-à-dire}
}
\NewDocumentCommand \Cad { } {
{C'est-à-dire}
}
2016-08-11 16:20:46 +00:00
2019-05-23 18:31:21 +00:00
%% textsuperscript and textsubscript
%%
2020-06-21 20:42:38 +00:00
\NewDocumentCommand \tup { g } {
\textsuperscript{#1}
}
\NewDocumentCommand \tub { g } {
\textsubscript{#1}
}
2019-05-23 18:31:21 +00:00
%% smileys
%%
2018-10-20 06:56:57 +00:00
\NewDocumentCommand \wink { } {
{\DejaVuSans 😉}
}
\NewDocumentCommand \lol { } {
{\DejaVuSans 😂}
}
\NewDocumentCommand \sad { } {
{\DejaVuSans 😞}
}
% double quoting
%%
\NewDocumentCommand \og { }{
<<
}
2019-11-20 17:39:01 +00:00
\NewDocumentCommand \fg { }{
>>
}
2019-05-23 18:31:21 +00:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2018-10-20 06:56:57 +00:00
2018-10-04 20:32:37 +00:00
2019-05-23 18:31:21 +00:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2018-10-04 20:32:37 +00:00
%
%
% MATHS
%
%
2018-11-04 09:16:13 +00:00
2019-05-23 18:31:21 +00:00
%% i & j vectors
%%
2016-05-28 21:20:44 +00:00
\NewDocumentCommand \veci { } {
\ensuremath{ \vec{\imath} }
2016-05-28 21:20:44 +00:00
}
\NewDocumentCommand \vecj { } {
\ensuremath{ \vec{\jmath} }
2016-05-28 21:20:44 +00:00
}
2020-04-29 19:49:48 +00:00
%% basis (i,j)
%%
\RenewDocumentCommand \ij { } {
\ensuremath{ \left(\vec{\imath}\; ;\; \vec{\jmath}\right) }
}
2019-05-23 18:31:21 +00:00
%% frame (O;i;j)
%%
2018-10-04 20:32:37 +00:00
\NewDocumentCommand \oij { } {
\ensuremath{ \left(O\; ;\; \vec{\imath}\; ;\; \vec{\jmath}\right) }
}
2019-05-23 18:31:21 +00:00
%% frame (O;I;I)
%%
2018-10-04 20:32:37 +00:00
\NewDocumentCommand \OIJ { } {
\ensuremath{ \left(O\; ;\; I\; ;\; J\right) }
}
2019-05-23 18:31:21 +00:00
%% frame (O;x;y)
%%
2018-10-16 21:08:59 +00:00
\NewDocumentCommand \oxy { } {
\ensuremath{ \left(O\; ;\; x\; ;\; y\right) }
}
2019-05-23 18:31:21 +00:00
%% vector arrow redefinition
%%
2018-10-04 20:32:37 +00:00
\renewcommand{\Vec}[1]{
2020-04-29 19:49:48 +00:00
\ensuremath{ \overrightarrow{#1\vphantom(} }
}
\renewcommand{\vec}[1]{
\ensuremath{ \overrightarrow{#1\vphantom(} }
2018-10-04 20:32:37 +00:00
}
2019-05-23 18:31:21 +00:00
%% positional notation
%%
2018-10-04 20:32:37 +00:00
\newcommand{\base}[2]{
\ensuremath{ \overline{#1\vphantom(}^{#2} }
}
2018-09-25 04:42:35 +00:00
2019-05-23 18:31:21 +00:00
%% sets: N, Z, D, Q, R\Q and R with possibility to minus some numbers
%%
2016-08-16 11:17:38 +00:00
\NewDocumentCommand \R { s g } {
\IfBooleanTF {#1} {
\IfNoValueTF {#2} {
% \mathchoice{\! \mathbb{R} \setminus \{0\} \!}
% {\ensuremath{ \mathbb{R} \setminus \{0\} }}
% {\! \mathbb{R} \setminus \{0\} \!}
% {\! \mathbb{R} \setminus \{0\} \!}
2020-08-20 15:19:11 +00:00
\ensuremath{\mathbb{R} \setminus \{0\}}
}{
% \mathchoice{\! \mathbb{R} \setminus \{0, #2\} \!}
% {\ensuremath{ \mathbb{R} \setminus \{0, #2\} }}
% {\! \mathbb{R} \setminus \{0, #2\} \!}
% {\! \mathbb{R} \setminus \{0, #2\} \!}
2020-08-20 15:19:11 +00:00
\ensuremath{\mathbb{R} \setminus \{0, #2\}}
}
}{
\IfNoValueTF {#2} {
% \mathchoice{\mathbb{R}}
% {\ensuremath{ \mathbb{R} }}
% {\mathbb{R}}
% {\mathbb{R}}
2020-08-20 15:19:11 +00:00
\ensuremath{ \mathbb{R} }
}{
% \mathchoice{\mathbb{R} \setminus \{#2\}}
% {\ensuremath{ \mathbb{R} \setminus \{#2\} }}
% {\mathbb{R} \setminus \{#2\}}
% {\mathbb{R} \setminus \{#2\}}
2020-08-20 15:19:11 +00:00
\ensuremath{\mathbb{R} \setminus \{#2\}}
}
}
}
\NewDocumentCommand \RQ { } {
2016-08-16 11:14:07 +00:00
\( \mathbb{R} \setminus \mathbb{Q} \)
}
2016-08-16 11:14:07 +00:00
\NewDocumentCommand \Q { s g } {
\IfBooleanTF {#1} {
\IfNoValueTF {#2} {
\ensuremath{\!\!\! \mathbb{Q} \setminus \{0\} \!\!}
2016-08-16 11:14:07 +00:00
}{
\ensuremath{\!\!\! \mathbb{Q} \setminus \{0, #2\} \!\!}
2016-08-16 11:14:07 +00:00
}
}{
\IfNoValueTF {#2} {
\ensuremath{\!\!\! \mathbb{Q} \!\!}
2016-08-16 11:14:07 +00:00
}{
\ensuremath{\!\!\! \mathbb{Q} \setminus \{#2\} \!\!}
2016-08-16 11:14:07 +00:00
}
}
}
2016-08-16 11:14:07 +00:00
\NewDocumentCommand \D { s g } {
\IfBooleanTF {#1} {
\IfNoValueTF {#2} {
\ensuremath{\!\!\! \mathbb{D} \setminus \{0\} \!\!}
2016-08-16 11:14:07 +00:00
}{
\ensuremath{\!\!\! \mathbb{D} \setminus \{0, #2\} \!\!}
2016-08-16 11:14:07 +00:00
}
}{
\IfNoValueTF {#2} {
\ensuremath{\!\!\! \mathbb{D} \!\!}
2016-08-16 11:14:07 +00:00
}{
\ensuremath{\!\!\! \mathbb{D} \setminus \{#2\} \!\!}
2016-08-16 11:14:07 +00:00
}
}
}
2016-08-16 11:14:07 +00:00
\NewDocumentCommand \Z { s g } {
\IfBooleanTF {#1} {
\IfNoValueTF {#2} {
\ensuremath{\!\!\! \mathbb{Z} \setminus \{0\} \!\!}
2016-08-16 11:14:07 +00:00
}{
\ensuremath{\!\!\! \mathbb{Z} \setminus \{0, #2\} \!\!}
2016-08-16 11:14:07 +00:00
}
}{
\IfNoValueTF {#2} {
\ensuremath{\!\!\! \mathbb{Z} \!\!}
2016-08-16 11:14:07 +00:00
}{
\ensuremath{\!\!\! \mathbb{Z} \setminus \{#2\} \!\!}
2016-08-16 11:14:07 +00:00
}
}
}
2016-08-16 11:14:07 +00:00
\NewDocumentCommand \N { s g } {
\IfBooleanTF {#1} {
\IfNoValueTF {#2} {
2020-08-20 15:19:11 +00:00
\ensuremath{\mathbb{N} \setminus \{0\}}
2016-08-16 11:14:07 +00:00
}{
2020-08-20 15:19:11 +00:00
\ensuremath{\mathbb{N} \setminus \{0, #2\}}
2016-08-16 11:14:07 +00:00
}
}{
\IfNoValueTF {#2} {
2020-08-20 15:19:11 +00:00
\ensuremath{\mathbb{N}}
2016-08-16 11:14:07 +00:00
}{
2020-08-20 15:19:11 +00:00
\ensuremath{\mathbb{N} \setminus \{#2\}}
2016-08-16 11:14:07 +00:00
}
}
}
%% dot product
%%
\NewDocumentCommand \dotprod{ s g g } {
\IfBooleanTF {#1} {
\ensuremath{
\vec{#2} \cdot \vec{#3}
}
}{
\ensuremath{
\overrightarrow{#1\vphantom(} \cdot \overrightarrow{#2\vphantom(}
}
}
}
2019-11-12 20:38:21 +00:00
%% math letter used as curve name
%%
2019-11-17 22:56:12 +00:00
\NewDocumentCommand \mscr{ G{f} } {
$ \mathscr{#1} $
}
2019-11-12 20:38:21 +00:00
%% point
%%
\NewDocumentCommand \point{ G{A} G{0} G{0} } {
$ #1\big(#2\ ;\ #3\big) $
}
2020-08-13 11:31:46 +00:00
%% print the acronym F.I. for "Forme indéterminée" in bold and sans-serif font.
%%
\NewDocumentCommand \FI{ } {
\textsf{\textbf{F.I.}}
}
2019-05-23 18:31:21 +00:00
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2017-02-17 14:09:27 +00:00
\makeatother