我绘制了以下内容
\documentclass{article}
\usepackage{graphicx} % Required for inserting images
\title{feynds}
\author{ts342139 }
\date{October 2023}
\usepackage{tikz}
\usetikzlibrary{fit}
\usepackage{xcolor}
\usepackage[compat=1.1.0]{tikz-feynman}
\usepackage{contour}
\usetikzlibrary{calc}
\usepackage{nicematrix}
\tikzfeynmanset{plain/.style=}
\usepackage{wrapfig}
\usepackage{fancyhdr}
\fancyhf{}
\fancyhead[LO,RE]{\nouppercase{\leftmark}}
\fancyfoot[C]{\thepage}
\pagestyle{fancy}
\usepackage{slashed}
\begin{document}
\maketitle
\pagestyle{fancy}
\fancyhf{}
%\fancyhead{LE}
\fancyhead[RO]{\nouppercase{\leftmark\hfill}}
\fancyfoot[LE,RO]{\hfill\thepage\hfill}
\begin{tikzpicture}[scale=1.5]
% Define the coordinates
\foreach \x in {0}
\foreach \y in {1,2,3,4}
\foreach \z in {0,1,2,3,4}
{
\draw (\x,\y,\z) circle (0.1cm);
\fill[green] (\x,\y,\z) circle (0.05cm);
}
\foreach \x in {0}
\foreach \y in {0}
\foreach \z in {1,2,3,4}
{
\draw (\x,\y,\z) circle (0.1cm);
\fill[green] (\x,\y,\z) circle (0.05cm);
}
\foreach \x in {1,2,3,4}
\foreach \y in {0,1,2,3,4}
\foreach \z in {0,1,2,3,4}
{
\draw (\x,\y,\z) circle (0.1cm);
\fill[green] (\x,\y,\z) circle (0.05cm);
}
% Connect the circles with dotted lines
\foreach \x in {0,1,2,3,4}
\foreach \y in {0,1,2,3,4}
\foreach \z in {0,1,2,3,4}
{
\draw[dotted] (\x,\y,\z) -- (\x+1,\y,\z);
\draw[dotted] (\x,\y,\z) -- (\x,\y+1,\z);
\draw[dotted] (\x,\y,\z) -- (\x,\y,\z+1);
}
% Draw the axes
\draw[->] (0,0,0) -- (4.5,0,0) node[anchor=north east]{$\nu_1$};
\draw[->] (0,0,0) -- (0,4.5,0) node[anchor=north west]{$\nu_2$};
\draw[->] (0,0,0) -- (0,0,4.5) node[anchor=south]{$\nu_3$};
\end{tikzpicture}
\end{document}
如何删除它们?
答案1
尽管您希望连接到4
s,但您不希望连接到s。因此,要么从循环中5
移除并单独处理这些情况,要么避免在循环内绘制到 s。我在这里采用第二种方法。4
5
\documentclass[tikz,border=5pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=1.5]
% define coords
\foreach \x in {0}
\foreach \y in {1,2,3,4}
\foreach \z in {0,1,2,3,4}
{
\draw (\x,\y,\z) circle (0.1cm);
\fill[green] (\x,\y,\z) circle (0.05cm);
}
\foreach \x in {0}
\foreach \y in {0}
\foreach \z in {1,2,3,4}
{
\draw (\x,\y,\z) circle (0.1cm);
\fill[green] (\x,\y,\z) circle (0.05cm);
}
\foreach \x in {1,2,3,4}
\foreach \y in {0,1,2,3,4}
\foreach \z in {0,1,2,3,4}
{
\draw (\x,\y,\z) circle (0.1cm);
\fill[green] (\x,\y,\z) circle (0.05cm);
}
% Connect the circles with dotted lines
\foreach \x in {0,1,2,3,4}
\foreach \y in {0,1,2,3,4}
\foreach \z in {0,1,2,3,4}
{
\ifnum\x<4
\draw[dotted] (\x,\y,\z) -- (\x+1,\y,\z);
\fi
\ifnum\y<4
\draw[dotted] (\x,\y,\z) -- (\x,\y+1,\z);
\fi
\ifnum\z<4
\draw[dotted] (\x,\y,\z) -- (\x,\y,\z+1);
\fi
}
% Draw the axes
\draw[->] (0,0,0) -- (4.5,0,0) node[anchor=north east]{$\nu_1$};
\draw[->] (0,0,0) -- (0,4.5,0) node[anchor=north west]{$\nu_2$};
\draw[->] (0,0,0) -- (0,0,4.5) node[anchor=south]{$\nu_3$};
\end{tikzpicture}
\end{document}
抱歉无法发布图片。KDE/Okular 目前有一个极其恼人的错误,导致此类图片在最好的情况下很丑陋,在最坏的情况下则毫无用处。此类图片显示虚线的可能性几乎为零。