emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: edgar <edgarlux@cryptolab.net>
To: emacs-orgmode@gnu.org
Subject: Tikz ugly hack
Date: Wed, 26 Oct 2022 08:52:35 +0000	[thread overview]
Message-ID: <2f3d4e17ac5e246f355ab9039943c269@cryptolab.net> (raw)

Dear Org users,

I just want to share a way to combine Tikz (LaTeX) with figures (svg, 
png...). This may be needed to add elements (e.g. annotations) to your 
figure. The figure may still be exported with other back-ends (without 
annotations). If you know of a better way of doing this, please, let me 
know. Thanks.

#+latex_header: \usepackage{adjustbox,tikz}
#+latex_header: \newcommand*{\DrawGrid}{\draw[step=.2cm,help lines] 
(current bounding box.south west) grid (current bounding box.north 
east);}
#+latex_header: \newcommand*{\DrawBoundingBox}[2]{% 
https://tex.stackexchange.com/a/542819
#+latex_header:     \draw [red, very thick, rounded corners]
#+latex_header:     ([shift={(#1)}]current bounding box.south west)
#+latex_header:     rectangle
#+latex_header:     ([shift={(#2)}]current bounding box.north east);}
#+begin_export latex
\begin{tikzpicture}
   % left bottom right top
   \node {\adjustbox{height=0.7\textheight,trim=45.6mm 0mm 155mm 20mm, 
clip=true}{
#+end_export
   #+attr_latex: :height "" :width "" :options "" :center nil
   [[file:../diagram.svg]]
#+begin_export latex
   }};
   \DrawBoundingBox{5.7cm,0.71cm}{-0.1cm,-3.6cm}
   % \DrawGrid
\end{tikzpicture}
#+end_export


             reply	other threads:[~2022-10-26  8:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-26  8:52 edgar [this message]
2022-10-26  9:58 ` Tikz ugly hack Fraga, Eric
2022-10-28  8:45   ` edgar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2f3d4e17ac5e246f355ab9039943c269@cryptolab.net \
    --to=edgarlux@cryptolab.net \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).