
Следующий код tikz quiver выглядит слишком большим при компиляции в latex. Есть ли способ уменьшить его?
Спасибо
\documentclass{article}
\usepackage{tikz-cd}
\begin{document}
\[\begin{tikzcd}[cramped]
&&&&&&&&&&& {v_7} \\
\\
&&&&&&&&&&& {v_1} \\
\\
&&&&&&&&&&& {v_4} \\
\\
&&&&&&&&&&& {v_{10}} \\
\\
&&&&&&&&& {v_{11}} &&&& {v_{12}} \\
&&&&&& {v_5} &&&&&&&&&& {v_6} \\
&&& {v_2} &&&&&&&&&&&&&&&& {v_3} \\
{v_8} &&&&&&&&&&&&&&&&&&&&&& {v_9}
\arrow[no head, from=7-12, to=9-10]
\arrow[no head, from=7-12, to=9-14]
\arrow[no head, from=9-10, to=9-14]
\arrow[no head, from=5-12, to=10-7]
\arrow[no head, from=5-12, to=10-17]
\arrow[no head, from=10-7, to=10-17]
\arrow[no head, from=3-12, to=11-4]
\arrow[no head, from=3-12, to=11-20]
\arrow[no head, from=11-4, to=11-20]
\arrow[no head, from=1-12, to=12-23]
\arrow[no head, from=1-12, to=12-1]
\arrow[no head, from=12-1, to=12-23]
\end{tikzcd}\]
\end{document}
решение1
\documentclass[tikz, border=1cm]{standalone}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}[cramped, sep=tiny]
&&&&&&&&&&& {v_7} \\
\\
&&&&&&&&&&& {v_1} \\
\\
&&&&&&&&&&& {v_4} \\
\\
&&&&&&&&&&& {v_{10}} \\
\\
&&&&&&&&& {v_{11}} &&&& {v_{12}} \\
&&&&&& {v_5} &&&&&&&&&& {v_6} \\
&&& {v_2} &&&&&&&&&&&&&&&& {v_3} \\
{v_8} &&&&&&&&&&&&&&&&&&&&&& {v_9}
\arrow[no head, from=7-12, to=9-10]
\arrow[no head, from=7-12, to=9-14]
\arrow[no head, from=9-10, to=9-14]
\arrow[no head, from=5-12, to=10-7]
\arrow[no head, from=5-12, to=10-17]
\arrow[no head, from=10-7, to=10-17]
\arrow[no head, from=3-12, to=11-4]
\arrow[no head, from=3-12, to=11-20]
\arrow[no head, from=11-4, to=11-20]
\arrow[no head, from=1-12, to=12-23]
\arrow[no head, from=1-12, to=12-1]
\arrow[no head, from=12-1, to=12-23]
\end{tikzcd}
\end{document}
решение2
Вот еще один способ сделать это.
Код в конце показывает только один треугольник, который будет работать, если вы используете его в tikzpicture
среде:
% ~~~ just one triangle ~~~~~~~~~~~~~~~~~~~~~~~
\draw ( 90:1) node[txt]{$v_1$} --
(200:2) node[txt]{$v_2$} --
(340:2) node[txt]{$v_3$} -- cycle;
- использовать полярные координаты
- проведите от (90:1) до (200:2) и до (340:2) и закройте и закончите (
;
) этот путь - ставьте a
node
каждый раз, когда вы находитесь на следующей позиции (следите за отсутствующими\
) - используйте стиль для этого узла, который просто заполняет часть белым цветом
- поместите здесь текст в математическом режиме
$ .. $
Рисуем второй И думаем с точки зрения рефакторинга, использование TeX-макроса кажется разумным:
Tikz
имеет тенденцию отдавать предпочтение\def
,\newcommand
конечно, по какой-то причине- Чтобы все было достаточно просто, я просто передаю вертикальную длину и 3 индекса (это, безусловно, можно было бы усовершенствовать)
- который абстрагирует тот же треугольник в:
\def\triag#1#2#3#4{% y-length, 3 indices
\draw ( 90:#1 ) node[txt]{$v_{#2}$} -- %
(200:2*#1) node[txt]{$v_{#3}$} -- %
(340:2*#1) node[txt]{$v_{#4}$} -- cycle;}%
Наконец, просто сделайте столько вызовов этих треугольников, сколько захотите, внутри tikzpicture
среды, которая расширяется в ряд указанных \draw ... ;
путей:
\documentclass[10pt,border=3mm,tikz]{standalone}
\def\triag#1#2#3#4{% y-length, 3 indices
\draw ( 90:#1 ) node[txt]{$v_{#2}$} -- %
(200:2*#1) node[txt]{$v_{#3}$} -- %
(340:2*#1) node[txt]{$v_{#4}$} -- cycle;}%
\begin{document}
\begin{tikzpicture}[
txt/.style={fill=white},
]
\triag{.5}{10}{11}{12}
\triag{1 }{4}{5}{6}
\triag{1.5}{1}{2}{3}
\triag{2 }{7}{8}{9}
\end{tikzpicture}
\end{document}
% ~~~ just one triangle ~~~~~~~~~~~~~~~~~~~~~~~
% \draw ( 90:1) node[txt]{$v_1$} --
% (200:2) node[txt]{$v_2$} --
% (340:2) node[txt]{$v_3$} -- cycle;
% ~~~ later refactored using a TeX macro \triag ~~~