Graphics, Figures & TablestikZ | Custom Arrows (GOST)

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
usr345
Posts: 37
Joined: Fri Apr 01, 2011 11:39 pm

tikZ | Custom Arrows (GOST)

Post by usr345 »

There is a Russian standard for the constructor documentation (GOST), where the arrows are defined to be:
gost.png
gost.png (1.33 KiB) Viewed 6029 times
But in tikZ arrows with such angle are missing. How can I make them?
Last edited by usr345 on Tue Nov 29, 2011 1:43 am, edited 4 times in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

Re: tikZ | Custom Arrows (GOST)

Post by Stefan Kottwitz »

Hi,

the image is missing. Could you upload it again?

Stefan
LaTeX.org admin
usr345
Posts: 37
Joined: Fri Apr 01, 2011 11:39 pm

Re: tikZ | Custom Arrows (GOST)

Post by usr345 »

Sorry, I tried to upload it to your server. But did something wrong.

Using my server now.
Last edited by usr345 on Mon Nov 28, 2011 3:44 pm, edited 1 time in total.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

tikZ | Custom Arrows (GOST)

Post by localghost »

usr345 wrote:Sorry, I tried to upload it your server. But did something wrong.

Using my server now.
The GIF file format is not allowed. I converted the image to PNG and uploaded it to the forum server. This way the picture will always be available. External links can expire.


Thorsten
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

tikZ | Custom Arrows (GOST)

Post by localghost »

Since the »arrows« library of the pgf/tikZ package does not define such arrow tips, you have to do that by yourself. The idea is to borrow code from similar arrow types and modify them.

The code below defines the new arrow types "angle 20" and "triangle 20" along with their reversed counterparts.

Code: Select all

\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{arrows}

\makeatletter
\pgfarrowsdeclare{angle 20}{angle 20}
{
  \pgfutil@tempdima=0.3pt%
  \advance\pgfutil@tempdima by.25\pgflinewidth%
  \pgfutil@tempdimb=7.29\pgfutil@tempdima\advance\pgfutil@tempdimb by.5\pgflinewidth%
  \pgfarrowsleftextend{+-\pgfutil@tempdimb}
  \pgfutil@tempdimb=.5\pgfutil@tempdima\advance\pgfutil@tempdimb by1.6\pgflinewidth%
  \pgfarrowsrightextend{+\pgfutil@tempdimb}
}
{
  \pgfutil@tempdima=0.3pt%
  \advance\pgfutil@tempdima by.25\pgflinewidth%
  \pgfsetdash{}{+0pt}
  \pgfsetroundcap
  \pgfsetmiterjoin
  \pgfpathmoveto{\pgfpointadd{\pgfqpoint{0.5\pgfutil@tempdima}{0pt}}{\pgfqpointpolar{167}{18\pgfutil@tempdima}}}
  \pgfpathlineto{\pgfqpoint{0.5\pgfutil@tempdima}{0pt}}
  \pgfpathlineto{\pgfpointadd{\pgfqpoint{0.5\pgfutil@tempdima}{0pt}}{\pgfqpointpolar{-167}{18\pgfutil@tempdima}}}
  \pgfusepathqstroke
}
\pgfarrowsdeclarereversed{angle 20 reversed}{angle 20 reversed}{angle 20}{angle 20}

\pgfarrowsdeclare{triangle 20}{triangle 20}
{
  \pgfutil@tempdima=0.5pt%
  \advance\pgfutil@tempdima by.25\pgflinewidth%
  \pgfutil@tempdimb=7.29\pgfutil@tempdima\advance\pgfutil@tempdimb by.5\pgflinewidth%
  \pgfarrowsleftextend{+-\pgfutil@tempdimb}
  \pgfutil@tempdimb=.5\pgfutil@tempdima\advance\pgfutil@tempdimb by1.6\pgflinewidth%
  \pgfarrowsrightextend{+\pgfutil@tempdimb}
}
{
  \pgfutil@tempdima=0.5pt%
  \advance\pgfutil@tempdima by.25\pgflinewidth%
  \pgfsetdash{}{+0pt}
  \pgfsetmiterjoin
  \pgfpathmoveto{\pgfpointadd{\pgfqpoint{0.5\pgfutil@tempdima}{0pt}}{\pgfqpointpolar{167}{12\pgfutil@tempdima}}}
  \pgfpathlineto{\pgfqpoint{0.5\pgfutil@tempdima}{0\pgfutil@tempdima}}
  \pgfpathlineto{\pgfpointadd{\pgfqpoint{0.5\pgfutil@tempdima}{0pt}}{\pgfqpointpolar{-167}{12\pgfutil@tempdima}}}
  \pgfpathclose
  \pgfusepathqfillstroke
}
\pgfarrowsdeclarereversed{triangle 20 reversed}{triangle 20 reversed}{triangle 20}{triangle 20}
\makeatother

\begin{document}
  \begin{tikzpicture}
    \draw[angle 20-angle 20] (0,0) -- (2,0);
    \draw[triangle 20-triangle 20] (0,0.5) -- (2,0.5);
  \end{tikzpicture}
\end{document}
This might need further adjustments. Whereas the "triangle 20" type looks good, I have the impression that the "angle 20" type is a bit distorted although I'm sure that I didn't modify parameters which could cause that. You may verify that with a printed document.


Thorsten
usr345
Posts: 37
Joined: Fri Apr 01, 2011 11:39 pm

tikZ | Custom Arrows (GOST)

Post by usr345 »

localghost wrote:I have the impression that the "angle 20" type is a bit distorted although I'm sure that I didn't modify parameters which could cause that. You may verify that with a printed document.
I verified. It seems to be an optical illusion when you are looking with a little zoom. I zoomed to max: 6400% and it looks almost perfect.
Attachments
arrow2.PNG
arrow2.PNG (9.55 KiB) Viewed 6011 times
arrow.png
arrow.png (12.69 KiB) Viewed 6012 times
Post Reply