Skip to content

Commit

Permalink
added new formula environments
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiomtzlosa committed Oct 16, 2024
1 parent 4c1b728 commit 36d5012
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 10 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Binary file modified report.pdf
Binary file not shown.
24 changes: 14 additions & 10 deletions utils/formulas.tex
Original file line number Diff line number Diff line change
@@ -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}
}
1 change: 1 addition & 0 deletions utils/imports.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
73 changes: 73 additions & 0 deletions utils/macros.tex
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
Expand All @@ -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}
Expand Down Expand Up @@ -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}}
Expand Down

0 comments on commit 36d5012

Please sign in to comment.