TransWikia.com

Long Compilation Time: Tikz Accents

TeX - LaTeX Asked by Mobius on January 22, 2021

Throughout my thesis, I have accent several mathematical symbols with "hats" and "checks". My advisor noted that the standard hat{}, check{} accents were difficult to read due to their size, so I made my own in Tikz. However, now LaTeX takes several (around three) minutes to compile the entire document.

Below is the code used to define these symbols. I do use the accents package. Is there a more efficient way to define custom accents for mathematical symbols? I imagine Tikz is running every time the compiler comes across my command which is what’s slowing it down, but I’m not sure how to avoid this. I am using TexMaker with the latest MikTex distribution for Windows.

% Some symbols 

newcommand{myhat}{%
mathbin{begin{tikzpicture}[line width = 0.15pt, smooth]
draw[smooth, fill] (0,0.1ex) -- ({0.5ex - 0.3pt},0.45ex) -- ({0.5ex + 0.3pt},0.45ex) -- (1ex, 0.1ex) -- (0.5ex ,0.4ex) -- (0,0.1ex);
draw[white](0,0ex) -- (0, 0.1);
end{tikzpicture} 
}}

newcommand what [1]{
accentset{myhat}{#1}
}

newcommand{mycheck}{%
mathbin{begin{tikzpicture}[line width = 0.15pt, smooth]
draw[smooth, fill, rotate = 180] (0,0.1ex) -- ({0.5ex - 0.3pt},0.45ex) -- ({0.5ex + 0.3pt},0.45ex) -- (1ex, 0.1ex) -- (0.5ex ,0.4ex) -- (0,0.1ex);
draw[white](0,-0.5ex) -- (0, 0);
end{tikzpicture}
}}

newcommand wcheck [1]{
accentset{mycheck}{#1}
}

 

One Answer

Save the tikz pictures in a savebox.

newsaveboxmyhat
saveboxmyhat{begin{tikzpicture}...end{tikzpicture}}
newcommandwhat[1]{accentset{mathbin{useboxmyhat}}{#1}}

Correct answer by gernot on January 22, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP