图书设置

图书设置

我正在制作一些关于我大学期间课堂笔记的书,我使用了多个软件包、页边距更改和新命令。我想在我所有的课堂笔记中使用这些设置,但我不想为每门课程的笔记复制粘贴超过 200 行的内容,所以我想问是否有办法将它们放在一个软件包中或类似的东西中,以便在不同的文档中多次使用(我使用 Overleaf 来制作它们)。感谢您的帮助,以下是代码:

\documentclass[a4paper, 12pt]{book}

% fuente de letra:
\usepackage{lmodern}
% matemáticas:
\usepackage{amsmath, amssymb} 
% idioma:
\usepackage[utf8]{inputenc}
\usepackage[spanish, es-tabla]{babel} % 'cuadro' es el título del caption de table por defecto siguiendo indicaciones de RAE; es-tabla lo cambia a 'tabla'
% gestión de párrafos (hace innecesario indicar el salto de línea con doble barra y elimina el indent de todos los párrafos):
\usepackage{parskip}
% enlaces a URLs:
\usepackage{hyperref}
% gráficos:
\usepackage{graphicx, wrapfig, subcaption}
% tablas:
\usepackage{array, multirow}

\newcommand{\dsin}[1]{\sin{\left(#1\right)}}
\newcommand{\dtan}[1]{\tan{\left(#1\right)}}
\newcommand{\dcos}[1]{\cos{\left(#1\right)}}
\newcommand{\dsec}[1]{\sec{\left(#1\right)}}
\newcommand{\dcsc}[1]{\csc{\left(#1\right)}}
\newcommand{\dcot}[1]{\cot{\left(#1\right)}}
\newcommand{\darcsin}[1]{\arcsin{\left(#1\right)}}
\newcommand{\darccos}[1]{\arccos{\left(#1\right)}}
\newcommand{\darctan}[1]{\arctan{\left(#1\right)}}
\newcommand{\dsinh}[1]{\sinh{\left(#1\right)}}
\newcommand{\dcosh}[1]{\cosh{\left(#1\right)}}
\newcommand{\dtanh}[1]{\tanh{\left(#1\right)}}

\newcommand{\dln}[1]{\ln{\left(#1\right)}}

\newcommand{\dsum}[2]{\displaystyle\sum_{#1}^{#2}}
\newcommand{\dlim}[2]{\lim_{#1\rightarrow#2}}
\newcommand{\dint}[2]{\displaystyle\int_{#1}^{#2}}
\newcommand{\doint}[2]{\displaystyle\oint_{#1}^{#2}}


\NewDocumentCommand{\umathnote}{ mm }
   {
     \overset % ❶
        {% The annotation goes above
          \textcolor{black!20!white}{\hbox to 0pt{\hss % ❷
             $ % return to math mode
               \begin{array}{c} % ❸
                   \displaystyle #2\\ % ❹
                   \bigg\downarrow % ❺
               \end{array}
             $
          \hss}
          }
        }
        {#1} % 
   }
   
\NewDocumentCommand{\dmathnote}{ mm }
   {
     \underset % ❶
        {% The annotation goes above
          \textcolor{black!20!white}{\hbox to 0pt{\hss % ❷
             $ % return to math mode
               \begin{array}{c} % ❸
                   \bigg\uparrow\\ % ❹
                   \displaystyle #2 % ❺
               \end{array}
             $
          \hss}
          }
        }
        {#1} % 
   }


\renewcommand{\baselinestretch}{1.35}
\usepackage{titlesec}
\makeatletter
\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}%
            {-2.5ex\@plus -1ex \@minus -.25ex}%
            {1.25ex \@plus .25ex}%
            {\normalfont\normalsize\bfseries}}
\makeatother
\setcounter{secnumdepth}{4} % how many sectioning levels to assign numbers to
\setcounter{tocdepth}{4}    % how many sectioning levels to show in ToC

\usepackage[all]{xy}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}
\usepackage{tikz}
\usetikzlibrary{calc, arrows}
\usepackage[makeroom]{cancel}
\renewenvironment{itemize}
{\begin{center}\large}
{\end{center}}
\usepackage[framemethod=TikZ]{mdframed}


\newcounter{dem}[chapter]\setcounter{dem}{0}
\renewcommand{\thedem}{\Roman{dem}}  
\newenvironment{dem}[2][]{%
\refstepcounter{dem}%
\ifstrempty{#1}%
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle,fill=white]
{\strut Demostración~\thedem};}}
}%
{\mdfsetup{%
frametitle={%
\tikz[baseline=(current bounding box.east),outer sep=0pt]
\node[anchor=east,rectangle,fill=white]
{\begin{minipage}{0.99\linewidth}Demostración~\thedem~#1\end{minipage}};}}%
}%
\mdfsetup{innertopmargin=10pt,linecolor=black,%
linewidth=0.5pt,topline=true,%
frametitleaboveskip=\dimexpr-\ht\strutbox\relax
}
\begin{mdframed}[]\relax%
\label{#2}}{\end{mdframed}}


\usepackage{nccmath}
\usepackage{tcolorbox}
\tcbuselibrary{most}

\newtcolorbox[auto counter,
              number within=chapter,
              list inside=ej
              ]{ej}[1][]{%
    enhanced, breakable,
    title={{\begin{minipage}{\linewidth}\textbf{Ejercicio}~\thetcbcounter.~\textit{#1}\end{minipage}}},
    halign title=left,
    sharp corners,
    colback=white,
    coltitle=black,
    colbacktitle=white,
    boxrule=0pt,frame hidden,
    underlay unbroken and first={%
         \ifnumequal{\tcbsegmentstate}{0}{
            \draw[black,double] (interior.north west)--(interior.south west);
        }{\ifnumequal{\tcbsegmentstate}{1}{
                \draw[black,double] (interior.north west)--(segmentation.west);
            \begin{tcbclipinterior}
                    \draw[help lines, step=3.8mm, black!20!white](segmentation.south west) grid (frame.south east);
            \end{tcbclipinterior}
        }{\ifnumequal{\tcbsegmentstate}{2}{
            \begin{tcbclipinterior}
                    \draw[help lines, step=3.8mm, black!20!white](interior.north west) grid (interior.south east);
            \end{tcbclipinterior}
        }}}
    },
    underlay middle and last={%
         \ifnumequal{\tcbsegmentstate}{0}{
            \draw[black,double] (interior.north west)--(interior.south west);
        }{\ifnumequal{\tcbsegmentstate}{1}{
                \draw[black,double] (interior.north west)--(segmentation.west);
            \begin{tcbclipinterior}
                    \draw[help lines, step=3.8mm, black!20!white](segmentation.south west) grid (frame.south east);
            \end{tcbclipinterior}
        }{\ifnumequal{\tcbsegmentstate}{2}{
            \begin{tcbclipinterior}
                    \draw[help lines, step=3.8mm, black!20!white](interior.north west) grid (interior.south east);
            \end{tcbclipinterior}
        }}}
    },
    boxed title style={%
      colframe=white, 
      boxrule=0pt,
      colback=white,
      left=0pt,
      right=0pt},
    attach boxed title to top left={xshift={-5pt}},
    lower separated=false, 
    before lower = {\tcbsubtitle[colback=white, opacityback=0, colframe=black, opacityframe=0, boxrule=1pt, height=1cm,  width=2.55cm, valign=center]{\textbf{Solution:}}}
}

\newtcolorbox[auto counter,
              number within=chapter,
              list inside=defi
              ]{defi}[1][]{%
    enhanced,
    title={{\begin{minipage}{0.99\linewidth}\textit{#1}\end{minipage}}},
    ,
    halign title=left,
    sharp corners,
    colback=white,
    coltitle=black,
    colbacktitle=white,
    boxrule=0pt,frame hidden,
    overlay unbroken={%
      \draw[black,double] (interior.north west)--(interior.south west);%
      },
    boxed title style={%
      colframe=white, 
      boxrule=0pt,
      colback=white,
      left=0pt,
      right=0pt},
    attach boxed title to top left={xshift={-5pt}},
}
\usepackage{float}

\usepackage{fancyhdr}

\usepackage{geometry}

\newgeometry{bottom=2cm,top=2cm,right=2cm,left=2cm,binding=1cm}

相关内容