1

I would like to have a latex style file nutsi.sty that includes the my-definition feature. I also want to set the pagesize (21cm x 21cm) and sets the entire document in bold typeface.

Managed to make a latex file that uses nutsi.sty

    \documentclass{book}
    \usepackage{nutsi}
\end{document}


Although this style file sets a page-size of 21cm x 21cm, how can I introduce an option that lets the user select either 1) a 21cm x 21cm pagesize; 2) an A4 pagesize; or a B5 pagesize.

This is the file nutsi.sty.

\usepackage{geometry}
\geometry{ paperheight=21cm, paperwidth=21cm, left=8mm, right=8mm,
  top=21mm, bottom=21mm}

\usepackage{fix-cm}
\makeatletter
\renewcommand\normalsize{%
   \@setfontsize\normalsize{13pt}{15pt}
   \abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@
   \abovedisplayshortskip \z@ \@plus3\p@
   \belowdisplayshortskip 6\p@ \@plus3\p@ \@minus3\p@
   \belowdisplayskip \abovedisplayskip
   \let\@listi\@listI}
\makeatother

\usepackage{bm}                % makes bold arguments
\usepackage[x11names]{xcolor}  % loads 317 named rgb colours

\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}

% use boldface for whole document
\boldmath
\renewcommand{\seriesdefault}{\bfdefault}

\newtheoremstyle{my-definition} % name of style
{8pt}       % measure of space above definition, e.g. {3pt}
{8pt}       % measure of space below definition, e.g. {3pt}
{\itshape}  % name of font for body of example
{}          % measure of space to indent, e.g. {3pt}
{\bfseries\itshape}           % name of font for heading
{\textcolor{DarkOrange3}{.}}  % punctuation between heading and body
{ }         % space after theorem heading
{\thmname{\textbf{\textit{#1}}}
 \textcolor{DarkOrange3}{\textbf{\thmnumber{#2}}}
 \thmnote{\textit{({#3})}} }

\theoremstyle{my-definition}
\newtheorem{definition}{\textcolor{Blue3}{Definition}}[section]

Veak
  • 1
  • 1
    It would be very helpful if you show us your version of nutsi.sty so we don't have to guess what might, or might not, be in it. – Peter Wilson Apr 25 '22 at 17:36
  • For the point "entire document in bold typeface" see for example https://tex.stackexchange.com/q/511967/117050 – Skillmon Apr 25 '22 at 19:29

1 Answers1

1

The following uses expkv-opt to provide package options with a key=value interface.

With this you have one option paper that takes one of the three possible values 21, a4, and b5.

Please note that in a package you should use \RequirePackage instead of \usepackage, and you don't need \makeatletter.

nutsi.sty

\ProvidesPackage{nutsi}[2022-04-25 custom style by Ephram]

\RequirePackage{expkv-opt,expkv-def} \ekvdefinekeys{nutsi} { choice-enum paper = \nutsi@paper {21, a4, b5} } \ekvoProcessLocalOptions{nutsi}

\RequirePackage{geometry} \ifcase\nutsi@paper \geometry{paperheight=21cm, paperwidth=21cm} \or \geometry{a4paper} \or \geometry{b5paper} \fi

\geometry{left=8mm, right=8mm, top=21mm, bottom=21mm}

\RequirePackage{fix-cm} \renewcommand\normalsize{% @setfontsize\normalsize{13pt}{15pt} \abovedisplayskip 10\p@ @plus2\p@ @minus5\p@ \abovedisplayshortskip \z@ @plus3\p@ \belowdisplayshortskip 6\p@ @plus3\p@ @minus3\p@ \belowdisplayskip \abovedisplayskip \let@listi@listI}

\RequirePackage{bm} % makes bold arguments \RequirePackage[x11names]{xcolor} % loads 317 named rgb colours

\RequirePackage{amsmath} \RequirePackage{amsthm} \RequirePackage{amssymb}

% use boldface for whole document \boldmath \renewcommand{\seriesdefault}{\bfdefault}

\newtheoremstyle{my-definition} % name of style {8pt} % measure of space above definition, e.g. {3pt} {8pt} % measure of space below definition, e.g. {3pt} {\itshape} % name of font for body of example {} % measure of space to indent, e.g. {3pt} {\bfseries\itshape} % name of font for heading {\textcolor{DarkOrange3}{.}} % punctuation between heading and body { } % space after theorem heading {\thmname{\textbf{\textit{#1}}} \textcolor{DarkOrange3}{\textbf{\thmnumber{#2}}} \thmnote{\textit{({#3})}} }

\theoremstyle{my-definition} \newtheorem{definition}{\textcolor{Blue3}{Definition}}[section]

the document

\documentclass{article}

\usepackage[paper=b5]{nutsi}

\usepackage{duckuments}

\begin{document} \duckument \end{document}

Skillmon
  • 60,462
  • Is expkv-opt, a latex built-in feature? – Veak Apr 25 '22 at 21:16
  • I am actually getting ! LaTeX Error: File expkv-opt.sty' not found.. – Veak Apr 25 '22 at 21:36
  • @Ephram after your previous question about locating the file .sty, does this answer your question? If not, add more comments asking for clarifications and I am sure Skillmon will help but if it does with your recent answer, make sure to tick it as done so the community bot doesn't bump it to the top! All the best –  Apr 26 '22 at 01:15
  • Yes it answers the question, although using expkv-opt is giving me Undefined control sequence on \IfFormatAtLeastTF. – Veak Apr 26 '22 at 01:18
  • @Ephram I have never seen that error before but I am sure that Skillmon has and will be able to help, sorry! Check back in tomorrow and there will probably be an edit or an answer here. –  Apr 26 '22 at 01:20
  • @Ephram expkv-opt doesn't support too-old kernel versions. Update your LaTeX-installation if you want to use it. But there are alternatives providing similar functionality, see for example there: https://tex.stackexchange.com/a/615014/117050 – Skillmon Apr 26 '22 at 08:41
  • @Ephram another alternative would be to use LaTeX2e's original built in option processing (which is less flexible, but for 3 alternatives should easily suffice, \DeclareOption and \ProcessOptions are the macros you want, just search for those). – Skillmon Apr 26 '22 at 08:45