\documentclass{l3doc} \usepackage[T1]{fontenc} \usepackage{pdfpages} \usepackage{standalone} \usepackage{tensorstyles} % \usepackage{readprov} % \ReadPackageInfos{tensorstyles} \edef\tensorstylesVersion{v1.0.1.4} %{\fileversion} \edef\tensorstylesDate{2026-04-28} %{\filedate} \usepackage{parskip} \usepackage{setspace} \usepackage{xspace} \onehalfspacing \usepackage{xcolor} \definecolor{tPrim}{HTML}{00707F} % Green-Blue \definecolor{tSec}{HTML}{5FA4B0} % Green-Blue light \definecolor{tAccent}{HTML}{F07F3C} % Orange \definecolor{tGrey}{HTML}{E6E6E1} % Grey-Beige % \usepackage{fancyvrb} \usepackage{listings} \lstset{ language=[LaTeX]{TeX}, basicstyle=\ttfamily, keywordstyle=\color{tPrim}\bfseries, commentstyle=\color{tSec}, stringstyle=\color{tSec}, backgroundcolor=\color{white}, numbers=none, numberstyle=\tiny\ttfamily, stepnumber=2, showspaces=false, showstringspaces=false, showtabs=false, frame=none, framerule=1pt, tabsize=2, rulesep=5em, captionpos=b, breaklines=true, breakatwhitespace=false, framexleftmargin=0em, framexrightmargin=0em, xleftmargin=0em, xrightmargin=0em, aboveskip=1em, belowskip=1em, morekeywords={plain,tensorsset}, } \lstMakeShortInline| \usepackage{hyperref} \setlength{\fboxsep}{0pt}% \usepackage{subcaption} % For subfigures \usepackage{cleveref} % for references \providecommand{\defopt}[1]{\underline{#1}}%{default: #1}% \NewDocumentEnvironment{DescribetensorstylesOption}{ o m m m }{ % At beginning of the environment \DescribeOption{#2} % from l3doc \IfNoValueTF{#1}{ % true => left empty intentionally }{ %false \DescribeOption{ % add extra info like added or updated dates to mimic 'function' env. \rule[2.5ex]{\linewidth}{0.3pt} \\[-3.5ex] {\scriptsize #1 \hfill\ } } } \begin{minipage}[t]{\textwidth} \textit{\textbf{\textcolor{tSec}{#3}}}\dotfill\,\defopt{#4}\par \begingroup \vspace{0.5em} }{ % At environment's end \par \endgroup \end{minipage} } %% ===================================================================== \title{\textsc{tensorstyles}\\ A package to provide generic customizable displays of tensors (including vector, matrix, etc.) separating them from their forms.} \author{Romain NOEL \\ \url{romainoel@free.fr}} \date{\tensorstylesVersion~---~\tensorstylesDate} \providecommand{\pkgName}{\textbf{\textsc{tensorstyles}}\xspace} %% ===================================================================== \begin{document} \maketitle \begin{abstract} They are different notation conventions for tensors. And according to the context (or the local rules) one would like to switch between conventions: keeping the meaning of each tensor, just changing the display. So, this package is here to print tensors according to their order yet independently from their meaning in a very customizable way. \end{abstract} \tableofcontents %% ------------------------------------ \section{Introduction} \pkgName was created to solve a problem we regularly faced: switching from one tensor notation to another. Such an action should be trivial but mainstream tensors libraries do not separate content and form, and only offer one or two notations each. Therefore, if a user wants to switch from one convention to another (let's say when publish in several journals), they will need to manually change all the command related to tensor by hand without changing the content of their documents. This is why we propose \pkgName, a package that allows the representation of tensors in many notations, and to switch between them seamlessly. %% ------------------------------------ \section{Getting started} \subsection{Installing from CTAN} The latest stable version of \pkgName is available on \href{https://ctan.org/pkg/tensorstyles}{CTAN} and should now be part of the usual \TeX\ distributions (\TeX\ Live, Mac\TeX\ , Mik\TeX\ ), under the name \textit{\pkgName}. It means that if your distribution is kept up-to-date, the package should normally be already installed on your system. If this is not the case, consider updating the packages of your Tex distribution. For \TeX\ Live and Mac\TeX\ users, this usually means running \begin{lstlisting} tlmgr update --all \end{lstlisting} or if administrative privileges are required \begin{lstlisting} sudo tlmgr update --all \end{lstlisting} For Mik\TeX\ users, please refer to \href{https://miktex.org/howto/update-miktex}{the official Mik\TeX\ documentation}. \subsection{Installing from Gitlab} If you want to use the cutting-edge development version of \pkgName, you can install it manually by following these steps: \begin{description} \item[Download the source] from \href{https://gitlab.com/RomainNOEL/tensorstyles}{\pkgName repository} using |git clone| or as a \href{https://gitlab.com/RomainNOEL/tensorstyles/-/archive/master/tensorstyles-master.zip}{zip archive} of the latest development version. \item[Compile the style files] by running |l3build unpack| inside the downloaded directory. (Or run \LaTeX{} directly on |source/tensorstyles.ins|.) \item[Move the resulting |*.sty| files] to the folder containing your presentation. To use \pkgName with many presentations, run |l3build install| or move the |*.sty| files to a folder in your \TeX{} path instead. \item[Use the package] by declaring \lstinline|\usepackage{tensorstyles}| in the preamble of your document. \end{description} \pkgName uses the l3build system to offer the following installation options for advanced users: \begin{description} \item[|l3build unpack|] builds the theme style files. \item[|l3build doc|] builds this documentation manual and the examples. \item[|l3build check|] builds the theme and manual. \item[|l3build clean|] removes the files generated by |l3build|. \item[|l3build install|] installs the theme into your local texmf folder. \item[|l3build uninstall|] removes the theme from your local texmf folder. \end{description} % \subsection{Overleaf} % \pkgName is therefore automatically supported for new documents. % If you want to switch older documents to use the \pkgName theme, you need to \href{https://www.overleaf.com/blog/new-feature-select-your-tex-live-compiler-version}{select % TexLive 2021 or higher as your TeX Live version} (this may cause issues with other packages used in your presentation). % In addition to that, a template project was created and is publicly available in the \href{https://www.overleaf.com/latex/templates/demopkg/wjyyzvdzqkgf}{Overleaf Gallery} to bootstrap your presentation. %% ------------------------------------ \subsection{A minimal example} The following code shows a minimal example \pkgName usage % , and the output generated is given on \cref{fig-minimal} . \begin{lstlisting} \documentclass{article} \usepackage{tensorstyles} \begin{document} $\tensor[preset=einstein]{4}{A}$ \end{document} \end{lstlisting} \begin{figure}[htp] \centering {$\tensor[preset=einstein]{4}{A}$} \caption{Result of a simple example.} \label{fig-minimal} \end{figure} \subsection{Dependencies} \pkgName depends on the following standard packages: \begin{itemize} \item |expl3| \item |amsmath| \item |amssymb| \item |mathtools| \end{itemize} \section{Creating and using commands} \subsection{Creating a command} The \pkgName package does not only provide a macro to create tensors. The users can create their own. To do so the package provides a command that acts in a manner similar to a constructor in object-oriented programming; this command is \texttt{\textbackslash DeclaretensorstylesCmd} It takes two arguments, the first is the name of the macro to create, including the backslash, and the second, optional argument, is a list of options to customize the display. For example: \begin{lstlisting} \DeclareTensorsCmd{\myTensorCmd}[preset=einstein] \DeclareTensorsCmd{\myOtherTensorCmd}[preset=math, arrows=true] \DeclareTensorsCmd{\thatTensorCmd}[preset=einstein, default-indices=contra] \DeclareTensorsCmd{\anotherTensorCmd}[preset=full] \end{lstlisting} Afterward the newly created command can be used. \subsection{Using a custom command}\label{sec:customCom} Once a command is created it can be used anywhere in the document afterward. All the commands take the same arguments. \begin{function}{\tensor[