%% %% This is file `FramedSyntax.sty', %% generated with the docstrip utility. %% %% The original source files were: %% %% FramedSyntax.dtx (with options: `package') %% %% Copyright (C) 2024 Claudio Beccari all rights reserved. %% %% Distributable under the LaTeX Project Public License, %% version 1.3c or higher (your choice). The latest version of %% this license is at: http://www.latex-project.org/lppl.txt %% \NeedsTeXFormat{LaTeX2e}[2019/01/01] \ProvidesPackage{FramedSyntax}% [2024-09-04 v.0.2.8 Typeset command syntax within a special frame] \IfPackageLoadedF{pict2e}{\RequirePackage{pict2e}} \IfPackageLoadedF{etoolbox}{\RequirePackage{etoolbox}} \IfPackageLoadedF{xkeyval}{\RequirePackage{xkeyval}} \IfPackageLoadedF{xcolor}{\RequirePackage{xcolor}} \providecommand*\FSmeta[1]{\textnormal{$\langle$\textit{#1}$\rangle$}} \providecommand*\FSmarg[1]% {\textnormal{\texttt{\char123}\FSmeta{#1}\texttt{\char125}}} \providecommand*\FSoarg[1]{\textnormal{\texttt{[}\FSmeta{#1}\texttt{]}}} \providecommand*\FSArg[1]{\textnormal{\texttt{\{#1\}}}} \let\FSMarg\FSArg \providecommand*\FSOarg[1]{\textnormal{\texttt{[#1]}}} \def\GT@splitargs#1,#2!{\def\@tempA{#1}\def\@tempB{#2}} \providecommand\FSgarg[1]{\textnormal{\GT@splitargs#1!\% \texttt{(}\FSmeta{\@tempA}\texttt{,}\FSmeta{\@tempB}\texttt{)}}} \providecommand*\FScomando[1]{\textnormal{\texttt{\string#1}}} \providecommand*{\FScs}[1]% {\textnormal{\texttt{\char92#1}\index{#1@\texttt{\char92#1}|textsc}}} \let\FScsindex\FScs \providecommand*\SFSambiente[2]{% \FScomando{\begin}\FSmarg{#1}\FSoarg{#2}\,\dots \FScomando{\end}\FSmarg{#1}} \providecommand*\DFSambiente[3]{% \FScomando{\begin}\FSmarg{#1}\FSoarg{#2}\FSoarg{#3}\,\dots \FScomando{\end}\FSmarg{#1}} \providecommand*\BFSambiente[1]{\FScomando{\begin}\FSmarg{#1}} \providecommand*\EFSambiente[1]{\FScomando{\end}\FSmarg{#1}} \IfPackageLoadedF{cfr-lm}{\let\texttm\texttt \let\texttv\texttt} \DeclareRobustCommand*\FSambstyle[1]{% {\normalfont\textsf{\slshape#1}}} \DeclareRobustCommand*\FSclassstyle[1]{% {\normalfont\texttv{\itshape#1}}} \DeclareRobustCommand*\FSfilestyle[1]{% {\normalfont\texttm{\texttt{#1}}}} \DeclareRobustCommand*\FSpackstyle[1]{% {\normalfont\texttm{\ifbool{PDFTeX}{\textit}{\itshape}{#1}}}}% \DeclareRobustCommand*\FSprogstyle[1]{{\normalfont\textsf{#1}}} \DeclareRobustCommand*\FSprog[1]{\FSprogstyle{#1}% \iflanguage{english}{\index{program!#1@\FSprogstyle{#1}|textsc}}% {\index{programma!#1@\FSprogstyle{#1}|textsc}}}% \DeclareRobustCommand*\FSpack[1]{\FSpackstyle{#1}% \iflanguage{english}{\index{package!#1@\FSpackstyle{#1}|textsc}}% {\index{pacchetto!#1@\FSpackstyle{#1}|textsc}}} \DeclareRobustCommand*\FSclass[1]{\FSclassstyle{#1}% \iflanguage{english}{\index{class!#1@\FSclassstyle{#1}|textsc}}% {\index{classe!#1@\FSclassstyle{#1}|textsc}}}% \DeclareRobustCommand*\file[1]{\FSfilestyle{#1}% \index{file!#1@\FSfilestyle{#1}|textsc}}% \DeclareRobustCommand*\FSamb[1]{\FSambstyle{#1}% \iflanguage{english}% {\index{environment!#1@\FSambstyle{#1}|textsc}}% {\index{ambiente!#1@\FSambstyle{#1}|textsc}}}% \DeclareRobustCommand*\FSopzstyle[1]{% {\normalfont\textsf{\slshape{#1}}}}% \DeclareRobustCommand*\FScontastyle[1]{{\normalfont\texttm{#1}}} \DeclareRobustCommand*\FSstilestyle[1]{{\normalfont\texttm{#1}}} \DeclareRobustCommand*\FSnumeristyle[1]{{\normalfont\texttm{#1}}} \DeclareRobustCommand*\FSumisurastyle[1]{{\normalfont\texttm{#1}}} \DeclareRobustCommand*\FSchiavestyle[1]{{\normalfont\texttm{#1}}} \DeclareRobustCommand*\FSdescrittorestyle[1]{{\normalfont\texttm{#1}}} \DeclareRobustCommand*\FSposizionestyle[1]{{\normalfont\texttm{#1}}} \DeclareRobustCommand*\FSallineamentostyle[1]{{\normalfont\texttm{#1}}} \DeclareRobustCommand*\FSopz[1]{\opzstyle{#1}% \iflanguage{english}{\index{option!#1@\FSopzstyle{#1}|textsc}}% {\index{opzione!#1@\opzstyle{#1}|textsc}}}% \DeclareRobustCommand*\FSconta[1]{\Fcontastyle{#1}% \iflanguage{english}{\index{counter!#1@\FScontastyle{#1}|textsc}}% {\index{contatore!#1@\FScontastyle{#1}|textsc}}} \DeclareRobustCommand*\FSstile[1]{\FSstilestyle{#1}% \iflanguage{english}{\index{page style!#1@\FSstilestyle{#1}|textsc}}% {\index{stile della pagina!#1@\FSstilestyle{#1}|textsc}}} \DeclareRobustCommand*\FSnumeri[1]{\FSnumeristyle{#1}% \iflanguage{english}{\index{numbering!#1@\FSnumeristyle{#1}|textsc}}% {\index{numerazione!#1@\FSnumeristyle{#1}|textsc}}} \DeclareRobustCommand*\FSumisura[1]{\FSumisurastyle{#1}% \iflanguage{english}{measuring unit!#1@\FSumisurastyle{#1}|textsc}% {\index{unità di misura!#1@\FSumisurastyle{#1}|textsc}}} \DeclareRobustCommand*\FSchiave[1]{\FSchiavestyle{#1}% \iflanguage{english}{\index{key!#1@\FSchiavestyle{#1}|textsc}}% {\index{chiave!#1@\chiavestyle{#1}|textsc}}} \DeclareRobustCommand*\FSdescrittore[1]{\FSdescrittorestyle{#1}% \iflanguage{english}% {\index{column descriptor!#1@\FSdescrittorestyle{#1}|textsc}}% {\index{descrittore di colonna!#1@\FSdescrittorestyle{#1}|textsc}}} \DeclareRobustCommand*\FSposizione[1]{\FSposizionestyle{#1}% \iflanguage{english}% {\index{floating object position!#1@\FSposizionestyle{#1}|textsc}}% {\index{posizione degli oggetti flottanti!#1@\FSposizionestyle{#1}|textsc}}}% \DeclareRobustCommand*\FSallineamento[1]{FS\allineamentostyle{#1}% \iflanguage{english}% {\index{allignment code!#1@\FSallineamentostyle{#1}|textsc}}% {\index{codice di allineamento!#1@\FSallineamentostyle{#1}|textsc}}} \newlength\SIfrthick \newlength\SIfrgap \newlength\SIfrwidth \newlength\SIfrheight \ifcsdef{insertwidth}{}{\newlength\insertwidth} \newlength\SIXR \newlength\SIYD \newlength\SIXL \newlength\SIYU \newdimen\radius \newdimen\framewidth \definecolor{SIbackground}{rgb}{0.95,0.95,0.95} \definecolor{SIframe}{rgb}{0.1,0.1,0.1} \definecolor{SItext}{rgb}{0,0,0} \def\SetSIbgd#1{\colorlet{SIbackground}{#1}} \def\SetSIfrm#1{\colorlet{SIframe}{#1}} \def\SetSItxt#1{\colorlet{SItext}{#1}} \DeclareOptionX{fboxrule}[1pt]{\fboxrule=#1} \DeclareOptionX{fboxsep}[1ex]{\fboxsep=#1} \DeclareOptionX{framecolor}[SIframe]{\SetSIfrm{#1}} \DeclareOptionX{backgroundcolor}[SIbackground]{\SetSIbgd{#1}} \DeclareOptionX{fontstyle}[\normalfont]{#1} \DeclareOptionX{radius}[\fboxsep]{\radius=#1} \DeclareOptionX{insertionwidth}[\linewidth]{\insertwidth=#1} \DeclareOptionX*{% \packageWarning{FramedSyntax}{`\CurrentOption' ignored}% } \ExecuteOptionsX{% fboxrule, fboxsep, framecolor, backgroundcolor, fontstyle, radius, insertionwidth } \ProcessOptionsX*\relax \providecommand\setfontsize{} \RenewDocumentCommand\setfontsize{O{1.2} m O{#1}}{% \fontsize{#2}{\fpeval{#1*#2}}\selectfont} \providecommand\strippt{} \renewcommand\strippt[1]{\csuse{strip@pt}#1} \providecommand\framedbox{} \RenewDocumentCommand\framedbox{m m m O{#3} m}{% \bgroup \dimen2=#1\relax \dimen0=\dimexpr#1-(#2+#3)*2\relax \setbox0\hbox{\parbox{\dimen0}{#5}}% \SIfrthick=#2\relax \SIXR=\dimexpr\wd0/2\relax \SIXL=-\SIXR\relax \SIYU=\dimexpr(\ht0+\dp0)/2\relax \SIYD=-\SIYU\relax \dimen4=#1\relax % box total width \dimen6=\dimexpr\ht0+\dp0+(#2+#3)*2\relax% box total height \dimen8=#4\relax % corner arc radius \edef\SIbase{\strippt{\dimen4}} \edef\SIalt{\strippt{\dimen6}} \edef\SIxoff{\strippt{\dimexpr0.5\dimen4}} \edef\SIyoff{\strippt{\dimexpr0.5\dimen6}} \unitlength=1pt \begin{picture}(\SIbase,\SIalt)(-\SIxoff,-\SIyoff) \Frame*{\dimen4}{\dimen6}{\dimen8}% \ifdim\SIfrthick>0pt\Frame{\dimen4}{\dimen6}{\dimen8}\fi \put(0,0){\makebox(0,0){\box0}}% \end{picture} \egroup \ignorespaces} \providecommand\Frame{} \RenewDocumentCommand\Frame{s m m m}{% \bgroup \SIXR=\dimexpr#2/2\relax \SIXL=-\SIXR% \SIYU=\dimexpr#3/2\relax \SIYD=-\SIYU% \IfBooleanTF{#1}{\linethickness{0pt}\color{SIbackground}}% {\linethickness{\SIfrthick}\color{SIframe}}% \moveto(\SIXR,\SIYD+#4)% \circlearc{\SIXR-#4}{\SIYU-#4}{#4}{0}{90}% \circlearc{\SIXL+#4}{\SIYU-#4}{#4}{90}{180}% \circlearc{\SIXL+#4}{\SIYD+#4}{#4}{180}{270}% \circlearc{\SIXR-#4}{\SIYD+#4}{#4}{270}{360}% \closepath \IfBooleanTF{#1}{\fillpath}{\strokepath}% \egroup\ignorespaces} \providecommand\includeframedtext{} \RenewDocumentCommand\includeframedtext{O{\insertwidth} m O{}}% {\bgroup \ExecuteOptionsX{#3}% \ifdimgreater{\insertwidth}{\linewidth}{\insertwidth=\linewidth}{}% \framedbox{\insertwidth}{\fboxrule}{\fboxsep}[\radius]{#2}% \egroup} \ProvideDocumentEnvironment{FramedSyntax}{}{}{} \RenewDocumentEnvironment{FramedSyntax}{o D(){}} {% environment opening commands \IfValueT{#1}{\setfontsize{#1}}% font size setting \ExecuteOptionsX{#2}% key = value options \ifdimgreater{\insertwidth}{\linewidth}% width corrrection {\insertwidth=\linewidth}{}% \framewidth=\insertwidth \let\meta\FSmeta \let\marg\FSmarg \let\oarg\FSoarg \let\Arg\FSArg \let\Marg\FSMarg \let\Oarg\FSOarg \let\garg\FSgarg \let\comando\FScomando \let\cs\FScs \let\csindex\FScs \let\Sambiente\SFSambiente \let\Dambiente\DFSambiente \let\Bambiente\BFSambiente \let\Eambiente\EFSambiente \let\amb\FSamb \let\ambstyle\FSambstyle \let\class\FSclass \let\classstyle\FSclassstyle \let\file\FSfile \let\filestyle\FSfilestyle \let\pack\FSpack \let\packstyle\FSpackstyle \let\prog\FSprog \let\progstyle\FSprogstyle \let\opz\FSopz \let\opzstyle\FSopzstyle \let\conta\FSconta \let\contastyle\FScontastyle \let\stile\FSstile \let\stilestyle\FSstilestyle \let\numeri\FSnumeri \let\numerystyle\FSnumeristyle \let\umisura\FSumisura \let\umisurastyle\FSumisurastyle \let\chiave\FSchiave \let\chiavestyle\FSchiavestyle \let\descrittore\FSdescrittore \let\descrittorestyle\FSDescrittorestyle \let\posizione\FSposizione \let\posizionestyle\FSposizionestyle \let\allineamento\FSallineamento \let\allineamentostyle\FSallineamentostyle \begin{lrbox}{2}% open the necessary boxes \begin{minipage}{% \dimexpr\framewidth-2\fboxrule-2\fboxsep}\obeylines }{% environment closing commands \end{minipage}\end{lrbox}% close the above boxes \begin{flushleft}% set the syntax thext flush left \includeframedtext{\box2}[#2] \end{flushleft}}% \NewDocumentEnvironment{Sintassi}{o D(){}}% {\begin{FramedSyntax}[#1](#2)}{\end{FramedSyntax}} %% This Work has the status of `maintained' %% %% The Current Maintainer is Claudio Beccari %% %% This work consists of this file FramedSyntax.dtx, %% and the derived files FramedSyntax.sty and FramedSyntax.pdf. %% %% End of file `FramedSyntax.sty'.