Debian Codegraph @

texmf-dist/doc/latex/uvlhighlight/uvlhighlight-doc.tex

raw
1 %% REFERENCES
2 \begin{filecontents}{references.bib}
3 @article{Benavides2025_UVL,
4 title = {{UVL}: Feature modelling with the Universal Variability Language},
5 journal = {Journal of Systems and Software},
6 volume = {225},
7 pages = {112326},
8 year = {2025},
9 issn = {0164-1212},
10 doi = {https://doi.org/10.1016/j.jss.2024.112326},
11 author = {David Benavides and Chico Sundermann and Kevin Feichtinger and José A. Galindo and Rick Rabiser and Thomas Thüm},
12 }
13 \end{filecontents}
14
15 %% MAIN DOCUMENT
16 \documentclass[a4paper,11pt]{article}
17
18 % --- References ---
19 %\usepackage[style=numeric]{biblatex}
20 %\addbibresource{references.bib}
21
22 % --- Packages ---
23 \usepackage[T1]{fontenc}
24 \usepackage[utf8]{inputenc}
25 \usepackage{lmodern}
26 \usepackage{geometry}
27 \usepackage{xcolor}
28 \usepackage{hyperref}
29 \usepackage{listings}
30 \usepackage{tcolorbox} % For nice boxes in documentation
31
32 % --- Load our custom package (Default Theme) ---
33 \usepackage{uvlhighlight}
34
35 % --- Configuration for the Manual ---
36 \geometry{left=2.5cm, right=2.5cm, top=3cm, bottom=3cm}
37 \hypersetup{
38 colorlinks=true,
39 linkcolor=blue,
40 urlcolor=blue,
41 pdftitle={uvlhighlight Package Documentation},
42 pdfauthor={José Miguel Horcas}
43 }
44
45 % --- Metadata ---
46 \title{\textbf{The \texttt{uvlhighlight} Package} \\ \large Syntax Highlighting for Universal Variability Language}
47 \author{José Miguel Horcas\\[email protected]}
48 \date{Version 1.3 -- \today}
49
50 \begin{document}
51
52 \maketitle
53
54 \begin{abstract}
55 The \texttt{uvlhighlight} package provides syntax highlighting for the Universal Variability Language (UVL) in \LaTeX. It is based on the listings package and supports all UVL keywords. The package includes multiple visual themes (default, Flamapy, UVLS dark mode, and black \& white) and provides inline commands for semantic highlighting.
56 It also supports user-defined features' attributes and the inclusion of external .uvl files.
57 \end{abstract}
58
59 \tableofcontents
60 \newpage
61
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63 \section{Introduction}
64 The \emph{Universal Variability Language} (UVL)~\cite{Benavides2025_UVL} is increasingly used in
65 Software Product Line Engineering. However, \LaTeX\ lacks native support for properly formatting UVL models.
66
67 The \texttt{uvlhighlight} package addresses this limitation by providing:
68 \begin{itemize}
69 \item Syntax highlighting.
70 \item Multiple visual themes.
71 \item Inline semantic commands.
72 \item Integration with \texttt{listings}.
73 \end{itemize}
74
75 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76 \section{Installation}
77 The package is available on CTAN and can be installed via your \TeX\ distribution
78 (e.g., TeX Live or MiKTeX). Alternatively, you can install it manually:
79
80 \begin{itemize}
81 \item Download the package from CTAN.
82 \item Place \texttt{uvlhighlight.sty} in your local \TeX\ tree.
83 \item Refresh the file database.
84 \end{itemize}
85
86 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
87 % \section{Compatibility}
88 % The package is compatible with:
89 % \begin{itemize}
90 % \item pdf\LaTeX
91 % \item Xe\LaTeX
92 % \item Lua\LaTeX
93 % \end{itemize}
94
95 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
96 \section{Quick Start}
97 Here is a minimal working example to start using the \texttt{uvlhighlight} package:
98
99 {\scriptsize
100 \begin{verbatim}
101 \documentclass{article}
102 \usepackage{uvlhighlight}
103
104 \begin{document}
105
106 \begin{lstlisting}[language=UVL]
107 features
108 Pizza
109 optional
110 Cheese
111 \end{lstlisting}
112
113 \end{document}
114 \end{verbatim}
115 }
116
117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
118 \section{Package Options}
119 You can customize the appearance and typography of the \UVL code by passing one of the following options:
120
121 \begin{description}
122 \item[\texttt{default}] (No option) Loads the standard color theme (Purple/Blue/Orange/Green) suitable for white backgrounds.
123 \item[\texttt{flamapy}] Loads the theme based on the Flamapy ecosystem (Blue/Red/Green).
124 \item[\texttt{uvls}] Loads a Dark Theme inspired by the Visual Studio Code \UVL plugin (requires a dark background, which is set automatically).
125 \item[\texttt{bw}] Loads a high-contrast Black \& White theme, optimized for academic papers and printing.
126 \item[\texttt{beramono}] (Default) Loads the \textit{Bera Mono} font. A more compact, slightly rounded monospaced font.
127 \item[\texttt{inconsolata}] Loads the \textit{Inconsolata} font. It is highly recommended for modern look and perfect bold support in \LaTeX.
128 \item[\texttt{nofont}] Disables automatic font loading. The package will use \texttt{lmodern} as a fallback to ensure that bold styles are correctly rendered even if you use the default \LaTeX\ typewriter font.
129 \end{description}
130
131 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
132 \section{User Interface}
133
134 \subsection{Commands}
135
136 \subsubsection{Custom attributes: \texttt{\textbackslash uvlattributes}}
137 \UVL models often contain domain-specific attributes (e.g., \texttt{Price}, \texttt{Weight}, \texttt{Latency}). To highlight these words specifically, use this command in your preamble.
138
139 \begin{verbatim}
140 \uvlattributes{Kcal, Price}
141 \end{verbatim}
142
143
144 \subsubsection{Inline Formatting Commands}
145 The following commands are defined by the package to easily highlight \UVL elements within the regular text of your document, applying the colors defined by the currently selected theme.
146
147 \begin{description}
148 \item[\texttt{\textbackslash UVL}] Write the acronym \UVL following the style of the official paper.
149 \item[\texttt{\textbackslash UVLKeyword\{text\}}] Applies the **Keyword** color (\texttt{alternative}, \texttt{mandatory}, etc.) and monospaced font.
150 \item[\texttt{\textbackslash feature\{text\}}] Applies the **Feature** color (\texttt{Pizza}, \texttt{Topping}, etc.) and monospaced font.
151 \item[\texttt{\textbackslash attribute\{text\}}] Applies the **Attribute** color (\texttt{Price}, \texttt{Kcal}, etc.) and monospaced font.
152 \item[\texttt{\textbackslash constraint\{text\}}] Applies monospaced font for entire constraint expressions.
153 \end{description}
154
155 \noindent \textbf{Example:}
156 \begin{tcolorbox}[colback=gray!5, colframe=gray!50, title=Inline Formatting Example]
157 % --- SOURCE CODE (Using listings to show the commands with breaklines) ---
158 \textbf{Source:}
159 \begin{lstlisting}[
160 language={}, % Disable syntax highlighting
161 basicstyle=\ttfamily\small, % Monospaced font, small size
162 breaklines=true, % Enable line wrapping
163 frame=none, % No frame/border
164 numbers=none, % No line numbers
165 breakindent = 0pt,
166 breakautoindent = false,
167 ]
168 The \attribute{Price} attribute is used in the constraint \constraint{sum(Price) < 12}. The feature \feature{Pizza} uses the \UVLKeyword{optional} keyword of \UVL.
169 \end{lstlisting}
170
171 % --- RESULT (Executing the commands for colored output) ---
172 \vspace{0.5em}
173 \textbf{Result:}
174 \par
175 \noindent \small
176 The \attribute{Price} attribute is used in the constraint \constraint{sum(Price) < 12}.
177 The feature \feature{Pizza} uses the \UVLKeyword{optional} keyword of \UVL.
178 \end{tcolorbox}
179
180 \subsection{Environments}
181
182 \subsubsection{\texttt{lstlisting} with \UVL}
183 You can use the standard \texttt{lstlisting} environment with \texttt{language=UVL}:
184
185 {\scriptsize
186 \begin{verbatim}
187 \begin{lstlisting}[language=UVL, caption={Simple Example}]
188 features
189 /* Multi-line
190 comment example */
191 Pizza {abstract}
192 optional
193 CheesyCrust {Kcal 370, Price 1.00}
194 Integer SpicyLvl
195 String Name // Esto es un comentario
196 mandatory
197 Topping {abstract}
198 or
199 Salami {Kcal 462}
200 Ham {Kcal 115}
201 Mozzarella {Kcal 310}
202 Anchovies {Kcal 210, Price 0.50}
203 Size {abstract}
204 alternative
205 "Normal size" {Price 8.00}
206 Big {Price 12.00}
207 Dough {abstract}
208 alternative
209 Neapolitan
210 Sicilian {Price 0.50}
211 constraints
212 (CheesyCrust & Sicilian) => Big
213 Neapolitan => (!Salami & !Ham)
214 sum(Price) < 12
215 Name => len(Name)<10 & Name=='Margherita'
216 SpicyLvl >= 1 & SpicyLvl <= 5
217 SpicyLvl==5 => SpicyLvl.Price==1.00
218 (SpicyLvl>=1 & SpicyLvl<5) => SpicyLvl.Price==0
219 \end{lstlisting}
220 \end{verbatim}
221 }
222
223 \subsubsection{\texttt{\textbackslash inputuvl}}
224 This command imports an external \texttt{.uvl} file and formats it as a \UVL code block.
225 It accepts optional arguments compatible with \texttt{lstinputlisting}.
226
227 \begin{verbatim}
228 \inputuvl[caption={My Model}, label={lst:model}]{model.uvl}
229 \end{verbatim}
230
231 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
232 \section{Examples}
233
234 \subsection{Typography Gallery}
235 The package supports different monospaced fonts optimized for code.
236
237 \begin{itemize}
238 \item \textbf{Bera Mono (Default):} {\fontfamily{fvm}\selectfont\small MyFeature \UVLKeyword{cardinality} [1..*] \{\attribute{Price} 2.50\}}
239 \item \textbf{Inconsolata:} {\fontfamily{zi4}\selectfont\small MyFeature \UVLKeyword{cardinality} [1..*] \{\attribute{Price} 2.50\}}
240 \item \textbf{Latin Modern (Fallback):} {\fontfamily{lmtt}\selectfont\small MyFeature \UVLKeyword{cardinality} [1..*] \{\attribute{Price} 2.50\}}
241 \end{itemize}
242
243 \subsection{Theme Gallery}
244 Below is a demonstration of the same \UVL model rendered using the four available themes.
245
246 % We define the attributes for the examples
247 \uvlattributes{Kcal, Price}
248
249 % --- 1. DEFAULT THEME ---
250 \subsubsection{Default Theme}
251 This is the default style loaded with \texttt{\textbackslash usepackage\{uvlhighlight\}}.
252
253 \inputuvl[caption={Pizza Model (Default Theme).}]{uvlhighlight-example.uvl}
254
255
256 % --- 2. FLAMAPY THEME ---
257 \subsubsection{Flamapy Theme}
258 Activated via \texttt{\textbackslash usepackage[flamapy]\{uvlhighlight\}}.
259
260 % Manually simulating the Flamapy theme colors for documentation purposes
261 \begingroup
262 \definecolor{UVLKeyword}{HTML}{0000FF}
263 \definecolor{UVLDelimiter}{HTML}{0431FA}
264 \definecolor{UVLString}{HTML}{A31515}
265 \definecolor{UVLNumber}{HTML}{098658}
266 \definecolor{UVLComment}{HTML}{008000}
267 \definecolor{UVLConstraint}{HTML}{D0A343}
268 \definecolor{UVLType}{HTML}{000000}
269 \definecolor{UVLAttribute}{HTML}{000000}
270 \definecolor{UVLUserAttribute}{HTML}{000000}
271 %\definecolor{UVLBackground}{white}
272 %\renewcommand{\uvlbasiccolor}{\color{black}}
273
274 \inputuvl[caption={Pizza Model (Flamapy Theme).}]{uvlhighlight-example.uvl}
275 \endgroup
276
277
278 % --- 3. UVLS (DARK) THEME ---
279 \subsubsection{UVLS Theme (Dark Mode)}
280 Activated via \texttt{\textbackslash usepackage[uvls]\{uvlhighlight\}}. This style mimics the Visual Studio Code plugin.
281
282 % Manually simulating the UVLS theme colors for documentation purposes
283 \begingroup
284 \definecolor{UVLFeature}{HTML}{9EDCFA}
285 \definecolor{UVLKeyword}{HTML}{C586BF}
286 \definecolor{UVLType}{HTML}{4EC9B0}
287 \definecolor{UVLString}{HTML}{CD9077}
288 \definecolor{UVLComment}{HTML}{58894B}
289 \definecolor{UVLAttribute}{HTML}{41C6F6}
290 \definecolor{UVLUserAttribute}{HTML}{41C6F6}
291 \definecolor{UVLConstraint}{HTML}{C2C385}
292 \definecolor{UVLOperator}{HTML}{FFFFFF}
293 \definecolor{UVLNumber}{HTML}{B5CEA8}
294 \definecolor{UVLDelimiter}{HTML}{EECE0C}
295 \definecolor{UVLBackground}{HTML}{000000}
296 \renewcommand{\uvlbasiccolor}{\color{UVLFeature}}
297
298 \inputuvl[caption={Pizza Model (UVLS Dark Theme).}]{uvlhighlight-example.uvl}
299 \endgroup
300
301
302 % --- 4. BW THEME ---
303 \subsubsection{Black \& White Theme}
304 Activated via \texttt{\textbackslash usepackage[bw]\{uvlhighlight\}}. Optimized for printed academic papers.
305
306 % Manually simulating the BW theme colors for documentation purposes
307 \begingroup
308 \definecolor{UVLKeyword}{HTML}{000000}
309 \definecolor{UVLType}{HTML}{000000}
310 \definecolor{UVLString}{gray}{0.3}
311 \definecolor{UVLComment}{gray}{0.5}
312 \definecolor{UVLAttribute}{HTML}{000000}
313 \definecolor{UVLUserAttribute}{HTML}{000000}
314 \definecolor{UVLConstraint}{HTML}{000000}
315 \definecolor{UVLFeature}{gray}{0.1}
316 \definecolor{UVLOperator}{HTML}{000000}
317 \definecolor{UVLNumber}{HTML}{000000}
318 \definecolor{UVLDelimiter}{HTML}{000000}
319 %\definecolor{UVLBackground}{white}
320 %\renewcommand{\uvlbasiccolor}{\color{black}}
321
322 \inputuvl[caption={Pizza Model (B\&W Theme).}]{uvlhighlight-example.uvl}
323 \endgroup
324
325 % \section{Technical details}
326 % The package relies on \texttt{listings} and automatically handles:
327 % \begin{itemize}
328 % \item \textbf{Case sensitivity}: UVL is treated as case-sensitive.
329 % \item \textbf{Strings}: Defined by single quotes (e.g., \texttt{'Margherita'}). Double quotes are also supported in some contexts.
330 % \item \textbf{Operators}: Symbols like \texttt{=>}, \texttt{\&}, \texttt{|}, \texttt{!=} are specially colored.
331 % \item \textbf{Delimiters}: Braces \texttt{\{\}}, brackets \texttt{[]}, and parentheses \texttt{()} are highlighted to show structure, especially in the UVLS theme.
332 % \end{itemize}
333
334 % \subsection{Font Encoding and Bold Support}
335 % The package automatically loads \texttt{fontenc} with \texttt{T1} encoding. This is crucial for correctly rendering symbols like \texttt{<}, \texttt{>}, and \texttt{|}.
336
337 % To avoid the common issue where \LaTeX\ typewriter fonts do not support bold weights, the package defaults to \textbf{Inconsolata}. If the \texttt{nofont} option is used, the package loads the \texttt{lmodern} (Latin Modern) family as a fallback, which provides the necessary font shapes to render keywords in bold.
338
339
340 \section{License}
341 This package is distributed under the terms of the
342 \href{https://www.latex-project.org/lppl/}{\LaTeX\ Project Public License (LPPL)}, version 1.3c.
343
344 % \section{Repository and Support}
345 % The development of this package is hosted on GitHub:
346
347 % \begin{itemize}
348 % \item Repository: \url{https://github.com/your-repo/uvl}
349 % \item Issue tracker: \url{https://github.com/your-repo/uvl/issues}
350 % \end{itemize}
351 % Bug reports and feature requests are welcome.
352
353 \section{Changelog}
354 \begin{itemize}
355 \item Version 1.3 (13th Apr 2026)
356 \begin{itemize}
357 \item Add new \UVL inline command.
358 \end{itemize}
359 \item Version 1.2 (16th Feb 2026)
360 \begin{itemize}
361 \item Support for compatible typography.
362 \end{itemize}
363 \item Version 1.1 (2nd Dec 2025)
364 \begin{itemize}
365 \item Add inline commands.
366 \end{itemize}
367 \item Version 1.0 (1st Dec 2025)
368 \begin{itemize}
369 \item Initial version of the package.
370 \end{itemize}
371 \end{itemize}
372
373 \bibliographystyle{plain}
374 \bibliography{references.bib}
375
376 \end{document}
377