Skip to content

Commit

Permalink
Rename LaTeX macros
Browse files Browse the repository at this point in the history
  • Loading branch information
chdemko committed Nov 12, 2024
1 parent 8c24588 commit 9c99bd1
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
24 changes: 12 additions & 12 deletions src/pandoc_latex_tip/_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,18 +713,18 @@ def get_prefix_even(position: str) -> str:
The latex prefix.
"""
if position == "right":
return "\\pandoclatextipevenright"
return "\\PandocLatexTipEvenRight"
if position in ("left", ""):
return "\\pandoclatextipevenleft"
return "\\PandocLatexTipEvenLeft"
if position == "inner":
return "\\pandoclatextipeveninner"
return "\\PandocLatexTipEvenInner"
if position == "outer":
return "\\pandoclatextipevenouter"
return "\\PandocLatexTipEvenOuter"
debug(
f"[WARNING] pandoc-latex-tip: {position}"
" is not a correct position; using left"
)
return "\\pandoclatextipevenleft"
return "\\PandocLatexTipEvenLeft"


def get_size(size: str) -> str:
Expand Down Expand Up @@ -941,20 +941,20 @@ def finalize(doc: Doc) -> None:
r"""
\makeatletter%
\newcommand{\PandocLatexTipOddInner}{\reversemarginpar}%
\newcommand{\pandoclatextipeveninner}{\reversemarginpar}%
\newcommand{\PandocLatexTipEvenInner}{\reversemarginpar}%
\newcommand{\PandocLatexTipOddOuter}{\normalmarginpar}%
\newcommand{\pandoclatextipevenouter}{\normalmarginpar}%
\newcommand{\PandocLatexTipEvenOuter}{\normalmarginpar}%
\newcommand{\PandocLatexTipOddLeft}{\reversemarginpar}%
\newcommand{\PandocLatexTipOddRight}{\normalmarginpar}%
\if@twoside%
\newcommand{\pandoclatextipevenright}{\reversemarginpar}%
\newcommand{\pandoclatextipevenleft}{\normalmarginpar}%
\newcommand{\PandocLatexTipEvenRight}{\reversemarginpar}%
\newcommand{\PandocLatexTipEvenLeft}{\normalmarginpar}%
\else%
\newcommand{\pandoclatextipevenright}{\normalmarginpar}%
\newcommand{\pandoclatextipevenleft}{\reversemarginpar}%
\newcommand{\PandocLatexTipEvenRight}{\normalmarginpar}%
\newcommand{\PandocLatexTipEvenLeft}{\reversemarginpar}%
\fi%
\makeatother%
\checkoddpage
\checkoddpage%
""",
"tex",
)
Expand Down
26 changes: 13 additions & 13 deletions tests/test_tip.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,31 +83,31 @@ def test_span(self):
\\ifoddpage%%
\\PandocLatexTipOddRight%%
\\else%%
\\pandoclatextipevenright%%
\\PandocLatexTipEvenRight%%
\\fi%%
\\marginnote{{\\href{{http://www.google.fr}}{{\\includegraphics[width=\\linewidth,height=2em,keepaspectratio]{{{platformdirs.AppDirs('pandoc_latex_tip').user_cache_dir}/darksalmon/fa-file-text.png}}}}\\includegraphics[width=\\linewidth,height=2em,keepaspectratio]{{{platformdirs.AppDirs('pandoc_latex_tip').user_cache_dir}/black/fa-comments.png}}\\includegraphics[width=\\linewidth,height=2em,keepaspectratio]{{Tux.pdf}}}}[0pt]\\vspace{{0cm}}%%
{{}}
\\checkoddpage%%
\\ifoddpage%%
\\PandocLatexTipOddLeft%%
\\else%%
\\pandoclatextipevenleft%%
\\PandocLatexTipEvenLeft%%
\\fi%%
\\marginnote{{\\includegraphics[width=\\linewidth,height=0.25in,keepaspectratio]{{{platformdirs.AppDirs('pandoc_latex_tip').user_cache_dir}/black/fa-exclamation-circle.png}}}}[0pt]\\vspace{{0cm}}%%
{{}}
\\checkoddpage%%
\\ifoddpage%%
\\PandocLatexTipOddLeft%%
\\else%%
\\pandoclatextipevenleft%%
\\PandocLatexTipEvenLeft%%
\\fi%%
\\marginnote{{\\includegraphics[width=\\linewidth,height=0.25in,keepaspectratio]{{{platformdirs.AppDirs('pandoc_latex_tip').user_cache_dir}/black/fa-comments.png}}}}[0pt]\\vspace{{0cm}}%%
{{}}
\\checkoddpage%%
\\ifoddpage%%
\\PandocLatexTipOddLeft%%
\\else%%
\\pandoclatextipevenleft%%
\\PandocLatexTipEvenLeft%%
\\fi%%
\\marginnote{{\\includegraphics[width=\\linewidth,height=0.25in,keepaspectratio]{{{platformdirs.AppDirs('pandoc_latex_tip').user_cache_dir}/orange/far-user.png}}}}[0pt]\\vspace{{0cm}}%%
""",
Expand Down Expand Up @@ -149,7 +149,7 @@ def test_codeblock(self):
\\ifoddpage%%
\\PandocLatexTipOddLeft%%
\\else%%
\\pandoclatextipevenleft%%
\\PandocLatexTipEvenLeft%%
\\fi%%
\\marginnote{{\\includegraphics[width=\\linewidth,height=0.25in,keepaspectratio]{{{platformdirs.AppDirs('pandoc_latex_tip').user_cache_dir}/black/fa-comments.png}}}}[0pt]\\vspace{{0cm}}%%
Expand Down Expand Up @@ -199,7 +199,7 @@ def test_div(self):
\\ifoddpage%%
\\PandocLatexTipOddLeft%%
\\else%%
\\pandoclatextipevenleft%%
\\PandocLatexTipEvenLeft%%
\\fi%%
\\marginnote{{\\includegraphics[width=\\linewidth,height=0.25in,keepaspectratio]{{{platformdirs.AppDirs('pandoc_latex_tip').user_cache_dir}/black/fa-comments.png}}}}[0pt]\\vspace{{0cm}}%%
""",
Expand All @@ -221,7 +221,7 @@ def test_div(self):
\\ifoddpage%%
\\PandocLatexTipOddRight%%
\\else%%
\\pandoclatextipevenright%%
\\PandocLatexTipEvenRight%%
\\fi%%
\\marginnote{{\\includegraphics[width=\\linewidth,height=0.33333in,keepaspectratio]{{{platformdirs.AppDirs('pandoc_latex_tip').user_cache_dir}/lightskyblue/fa-address-book.png}}}}[0pt]\\vspace{{0cm}}%%
""",
Expand All @@ -242,7 +242,7 @@ def test_div(self):
\\ifoddpage%%
\\PandocLatexTipOddRight%%
\\else%%
\\pandoclatextipevenright%%
\\PandocLatexTipEvenRight%%
\\fi%%
\\marginnote{{\\includegraphics[width=\\linewidth,height=0.33333in,keepaspectratio]{{Tux.pdf}}}}[0pt]\\vspace{{0cm}}%%
""",
Expand Down Expand Up @@ -285,7 +285,7 @@ def test_div_div(self):
\\ifoddpage%%
\\PandocLatexTipOddLeft%%
\\else%%
\\pandoclatextipevenleft%%
\\PandocLatexTipEvenLeft%%
\\fi%%
\\marginnote{{\\includegraphics[width=\\linewidth,height=0.25in,keepaspectratio]{{{platformdirs.AppDirs('pandoc_latex_tip').user_cache_dir}/black/fa-comments.png}}}}[0pt]\\vspace{{0cm}}%%
""",
Expand Down Expand Up @@ -325,7 +325,7 @@ def test_div_rule(self):
\\ifoddpage%%
\\PandocLatexTipOddLeft%%
\\else%%
\\pandoclatextipevenleft%%
\\PandocLatexTipEvenLeft%%
\\fi%%
\\marginnote{{\\includegraphics[width=\\linewidth,height=0.25in,keepaspectratio]{{{platformdirs.AppDirs('pandoc_latex_tip').user_cache_dir}/black/fa-comments.png}}}}[0pt]\\vspace{{0cm}}%%
Expand Down Expand Up @@ -369,7 +369,7 @@ def test_div_lineblock(self):
\\ifoddpage%%
\\PandocLatexTipOddLeft%%
\\else%%
\\pandoclatextipevenleft%%
\\PandocLatexTipEvenLeft%%
\\fi%%
\\marginnote{{\\includegraphics[width=\\linewidth,height=0.25in,keepaspectratio]{{{platformdirs.AppDirs('pandoc_latex_tip').user_cache_dir}/black/fa-comments.png}}}}[0pt]\\vspace{{0cm}}%%
\\\\
Expand Down Expand Up @@ -414,7 +414,7 @@ def test_div_codeblock(self):
\\ifoddpage%%
\\PandocLatexTipOddLeft%%
\\else%%
\\pandoclatextipevenleft%%
\\PandocLatexTipEvenLeft%%
\\fi%%
\\marginnote{{\\includegraphics[width=\\linewidth,height=0.25in,keepaspectratio]{{{platformdirs.AppDirs('pandoc_latex_tip').user_cache_dir}/black/fa-comments.png}}}}[0pt]\\vspace{{0cm}}%%
Expand Down Expand Up @@ -467,7 +467,7 @@ def test_div_bulletlist(self):
\\ifoddpage%%
\\PandocLatexTipOddLeft%%
\\else%%
\\pandoclatextipevenleft%%
\\PandocLatexTipEvenLeft%%
\\fi%%
\\marginnote{{\\includegraphics[width=\\linewidth,height=0.25in,keepaspectratio]{{{platformdirs.AppDirs('pandoc_latex_tip').user_cache_dir}/black/fa-comments.png}}}}[0pt]\\vspace{{0cm}}%%
\\item
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9c99bd1

Please sign in to comment.