Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing macros to imagify #16

Open
amael-ls opened this issue May 29, 2024 · 2 comments
Open

Parsing macros to imagify #16

amael-ls opened this issue May 29, 2024 · 2 comments

Comments

@amael-ls
Copy link

First of all, many thanks for this extension!

I am trying to use a macro and a tikzstyle in a TikZ picture but they both seem to fail:

  1. \newcommand{\env}{\mathcal{E}}
  2. \tikzstyle{arrow} = [->, > = Latex, very thick]

I am going to show the problem with tikzstyle only as I suspect the problems to be similar.


Here is the code that works (provided imagify is installed of course):
test_work.qmd:

---
title: "Test"
lang: en-GB
pdf-engine: lualatex
filters:
  - imagify
imagify:
  header-includes: |
    \usepackage{tikz}
    \usetikzlibrary{positioning}
    \usetikzlibrary{arrows.meta}
  pdf-engine: lualatex
format:
  html:
    toc: true
  pdf:
    include-in-header:
      - text: |
          \usepackage{tikz}
          \usetikzlibrary{positioning}
          \usetikzlibrary{arrows.meta}
---

![A test](./testFig_work.tex){#fig-testFig}

testFig_work.tex:

\begin{tikzpicture}
	%% Define nodes
	\node (N0) at (0, 0) {N0};
	\node[right = of N0] (N1) {N1};

	\draw[->, > = Latex, very thick] (N0) -- (N1);
\end{tikzpicture}

Here is the code that does not work:
test_fail.qmd:

---
title: "Test"
lang: en-GB
pdf-engine: lualatex
filters:
  - imagify
imagify:
  header-includes: |
    \usepackage{tikz}
    \usetikzlibrary{positioning}
    \usetikzlibrary{arrows.meta}
    \tikzstyle{arrow} = [->, > = Latex, very thick]
  pdf-engine: lualatex
format:
  html:
    toc: true
  pdf:
    include-in-header:
      - text: |
          \usepackage{tikz}
          \usetikzlibrary{positioning}
          \usetikzlibrary{arrows.meta}
          \tikzstyle{arrow} = [->, > = Latex, very thick]
---

![A test](./testFig_fail.tex){#fig-testFig}

testFig_fail.tex:

\begin{tikzpicture}
	%% Define nodes
	\node (N0) at (0, 0) {N0};
	\node[right = of N0] (N1) {N1};

	\draw[arrow] (N0) -- (N1);
\end{tikzpicture}

I gathered in a zip the four files.

I am doing anything wrong or is there a bug in transmitting the macros and tikzstyle?
test.zip

@amael-ls
Copy link
Author

@amael-ls
Copy link
Author

Ok, the error comes from the fact that tikzstyle is outdated and that tikzset should be used instead (see the complete answer on tex.stackexchange).

\tikzset{arrow/.style = {->, > = Latex, very thick}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant