diff --git a/Makefile b/Makefile index d8a13bb..4943b61 100755 --- a/Makefile +++ b/Makefile @@ -81,6 +81,14 @@ endif echo "" endif +bbl: + pdflatex -enable-write18 --shell-escape $(DOC).tex + bibtex $(DOC).aux + bibtex $(PUBS).aux + pdflatex -enable-write18 --shell-escape $(DOC).tex + pdflatex -enable-write18 --shell-escape $(DOC).tex + makeglossaries $(DOC) + make all # compile with index and without bibliography simple: nobib diff --git a/report.pdf b/report.pdf index a6baa06..8748f5e 100644 Binary files a/report.pdf and b/report.pdf differ diff --git a/utils/formulas.tex b/utils/formulas.tex index 8ecf5d9..69ad3d2 100644 --- a/utils/formulas.tex +++ b/utils/formulas.tex @@ -1,29 +1,33 @@ \newcommandtwoopt{\KittelEquationExpandedX}[2][Theoretical Kittel equation expanded for a Permalloy thin-film for X-axe][fig:kittel-x]{ \vspace{-0.5cm} - \setequation{0cm}{0cm}{ + \begin{addequation}{0cm}{0cm}{#2}{#1}{true} \small{\[\textit{f} = 28\cdot\sqrt{(B_{DC}+(N_y-N_x)\cdot0.86\cdot10^6\cdot4\pi\cdot10^{-7})\cdot(B_{DC}+(N_z-N_x)\cdot0.86\cdot10^6)\cdot4\pi\cdot10^{-7}}\]} - }{#2}{#1} + \end{addequation} } \newcommandtwoopt{\KittelEquationExpandedXBoxed}[2][Theoretical Kittel equation expanded for a Permalloy thin-film for X-axe][fig:kittel-x-box]{ \vspace{-0.5cm} - \setequationboxed{0cm}{0cm}{ - \colorboxed{red}{11pt}{ + \begin{addequationboxed}{0cm}{0cm}{#2}{#1}{0.11cm}{true} + \begin{colorequbox}{red}{11pt} +% \setequationboxed{0cm}{0cm}{ +% \colorboxed{red}{11pt}{ \begin{aligned} &f = 28\cdot\sqrt{(B_{DC}+(N_y-N_x)\cdot0.86\cdot10^6\cdot4\pi\cdot10^{-7})\cdot(B_{DC}+(N_z-N_x)\cdot0.86\cdot10^6)\cdot4\pi\cdot10^{-7}} \\ &\text{This line is a comment in boxed formula} \end{aligned} - } - }{#2}{#1}{0.11cm} +% } +% } + \end{colorequbox} + \end{addequationboxed} \vspace{0.8cm} } \newcommandtwoopt{\KittelEquationExpandedXBoxedSimple}[2][Theoretical Kittel equation expanded for a Permalloy thin-film for X-axe][fig:kittel-x-box-simple]{ \vspace{-0.5cm} - \setequationboxed{0cm}{0cm}{ - \colorboxed{red}{11pt}{ + \begin{addequationboxed}{0cm}{0cm}{#2}{#1}{0.11cm}{true} + \begin{colorequbox}{red}{11pt} f = 28\cdot\sqrt{(B_{DC}+(N_y-N_x)\cdot0.86\cdot10^6\cdot4\pi\cdot10^{-7})\cdot(B_{DC}+(N_z-N_x)\cdot0.86\cdot10^6)\cdot4\pi\cdot10^{-7}} - } - }{#2}{#1}{0.11cm} + \end{colorequbox} + \end{addequationboxed} \vspace{0.8cm} } diff --git a/utils/imports.tex b/utils/imports.tex index 860adcf..862ba3e 100644 --- a/utils/imports.tex +++ b/utils/imports.tex @@ -23,6 +23,7 @@ %\usepackage[letterpaper,margin=2.2cm]{geometry} %\usepackage[pdftex]{graphicx} %% loaded twice \usepackage[nodayofweek]{datetime} +\usepackage{environ} %\usepackage{subfig} \usepackage{subcaption} \usepackage[labelfont=bf]{caption} diff --git a/utils/macros.tex b/utils/macros.tex index 7c76448..006796e 100644 --- a/utils/macros.tex +++ b/utils/macros.tex @@ -222,6 +222,31 @@ \newcommand{\equationname}{Equation} \DeclareFloatingEnvironment[name={\protect\equationname}]{eqfigure} +% https://tex.stackexchange.com/questions/534403/how-to-format-custom-cwl-for-texstudio-completion +% https://tex.stackexchange.com/questions/596938/texstudio-newenvironment-not-recognized-as-math-mode-fix-with-cwl#596964 +\newenvironment{addequation}[5] {% + \edef\EnvParamThree{\unexpanded{#3}}% + \edef\EnvParamFour{\unexpanded{#4}}% + \edef\EnvParamFive{\unexpanded{#5}}% + \begin{equ}[H]% + % https://tex.stackexchange.com/questions/316646/renaming-the-label-of-figure-just-in-some-cases + % \renewcommand{\figurename}{Equation} +% \vspace{-0.6cm}% + \begin{changemargin}{#1}{#2}% + \begin{eqfigure}[H]% + }{% + \vspace{-0.7cm}% + \centercaptionequation{\EnvParamFour}% + \label{\EnvParamThree}% + \ifthenelse{\equal{\EnvParamFive}{true}}{% + \addequations{\EnvParamFour} % this is for equations listing + }{}% + \end{eqfigure}% + \end{changemargin}% + \vspace{-1.5cm}% + \end{equ}% +}% + \newcommand{\setequation}[5] { \begin{equ}[H] @@ -241,6 +266,31 @@ \end{equ} } +\newenvironment{addequationboxed}[6] {% + \edef\EnvParamThree{\unexpanded{#3}}% + \edef\EnvParamFour{\unexpanded{#4}}% + \edef\EnvParamFive{\unexpanded{#5}}% + \edef\EnvParamSix{\unexpanded{#6}}% + % + \begin{equ}[H]% + % https://tex.stackexchange.com/questions/316646/renaming-the-label-of-figure-just-in-some-cases + % \renewcommand{\figurename}{Equation} + \begin{changemargin}{#1}{#2}% + \begin{eqfigure}[H]% + }{% + \vspace{\EnvParamFive}% + \centercaptionequation{\EnvParamFour}% + % \centercaptionformula{#5} + \label{\EnvParamThree}% + \ifthenelse{\equal{\EnvParamSix}{true}}{% + \addequations{\EnvParamFour} % this is for equations listing + }{}% + \end{eqfigure}% + \end{changemargin}% + \vspace{-1.5cm}% + \end{equ}% +}% + \newcommand{\setequationboxed}[6] { \begin{equ}[H] @@ -260,6 +310,13 @@ \end{equ} } +% https://tex.stackexchange.com/questions/436165/capture-the-content-within-an-environment +\NewEnviron{colorequbox}[2]{% + \colorboxed{#1}{#2}{ + \BODY + } +} + \newcommand{\centerformula}[1]{ \vspace{-0.8cm} \begin{align} @@ -870,6 +927,22 @@ }{}% }% + +% Check if counter exists +% https://tex.stackexchange.com/questions/155776/check-if-counter-exists +\makeatletter +\newcommand*\ifcounter[1]{% + \ifcsname c@#1\endcsname% + \expandafter\@firstoftwo% + \else% + \expandafter\@secondoftwo% + \fi% +}% +\makeatother + +% Create new counter +\newcommand{\checkorcreatecounter}[1]{\ifcounter{#1}{\relax}{\newcounter{#1}}}% + % only for overleaf in local installation, solve glossary extra space on the left %\let\oldgls\gls %\renewcommand{\gls}[1]{\hspace{-1.9em}\oldgls{#1}}