TeX - LaTeX Asked by trieasyboid on March 21, 2021
Could somebody please help me? The north east and north west lines aren’t working how I thought they would as it’s just showing lots of little lines. I found this workaround which works perfectly. The only problem is that I need the south east lines to have the same gap between each line as the horizontal lines. I’ve tried playing with the values but I couldn’t find what I needed. Any help would be great 😀
I have a working knowledge of latex, so the simpler, the better 😀
documentclass{article}
usepackage[utf8]{inputenc}
usepackage{tikz}
usepackage{sectsty}
usepackage{titlesec}
usetikzlibrary{patterns}
pgfdeclarepatternformonly{south west lines}{pgfqpoint{-0pt}{-0pt}}{pgfqpoint{3pt}{3pt}}{pgfqpoint{3pt}{3pt}}{
pgfsetlinewidth{0.4pt}
pgfpathmoveto{pgfqpoint{0pt}{0pt}}
pgfpathlineto{pgfqpoint{3pt}{3pt}}
pgfpathmoveto{pgfqpoint{2.8pt}{-0.2pt}}
pgfpathlineto{pgfqpoint{3.2pt}{.2pt}}
pgfpathmoveto{pgfqpoint{-.2pt}{2.8pt}}
pgfpathlineto{pgfqpoint{.2pt}{3.2pt}}
pgfusepath{stroke}}
pgfdeclarepatternformonly{south east lines}{pgfqpoint{-0pt}{-0pt}}{pgfqpoint{3pt}{3pt}}{pgfqpoint{3pt}{3pt}}{
pgfsetlinewidth{0.4pt}
pgfpathmoveto{pgfqpoint{0pt}{3pt}}
pgfpathlineto{pgfqpoint{3pt}{0pt}}
pgfpathmoveto{pgfqpoint{.2pt}{-.2pt}}
pgfpathlineto{pgfqpoint{-.2pt}{.2pt}}
pgfpathmoveto{pgfqpoint{3.2pt}{2.8pt}}
pgfpathlineto{pgfqpoint{2.8pt}{3.2pt}}
pgfusepath{stroke}}
begin{document}
begin{tikzpicture}
draw [pattern=south west lines, pattern color=red] (0,0)--(0,1)--(1,1)--(1,0)--cycle;
end{tikzpicture}
begin{tikzpicture}
draw [pattern=horizontal lines, pattern color=red] (0,0)--(0,1)--(1,1)--(1,0)--cycle;
end{tikzpicture}
end{document}
If you use patterns.meta
instead, things become much easier. You can just set the distance
between the lines, and their angle
.
documentclass{article}
usepackage[utf8]{inputenc}
usepackage{tikz}
usetikzlibrary{patterns.meta}
begin{document}
begin{tikzpicture}
draw [pattern={Lines[angle=45,distance=4pt]},pattern color=red]
(0,0) rectangle (1,1);
end{tikzpicture}
begin{tikzpicture}
draw [pattern={Lines[angle=0,distance=4pt]},pattern color=red]
(0,0) rectangle (1,1);
end{tikzpicture}
end{document}
Correct answer by user228539 on March 21, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP