首頁>LaTeX>source

我正在尝試绘製類似於圖片中的立方體,但我没有得到理想的結果.

\documentclass[letterpaper, 12pt]{article}
\usepackage[margin = 1in]{geometry}
\usepackage[spanish]{babel}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\usepackage{xcolor}
\begin{document}
\begin{tikzpicture}
\draw[dashed] (2,0,0) -- (2,2,0) node[midway,right] {$L$};
\draw [dashed] (0,2,2) -- (0,0,2);
\draw[dashed] (0,0,0) -- (0,2,0);
\draw [dashed] (2,0,2) -- (2,2,2);
\draw[very thick] (0,2,0) -- (0,2,2) -- (2,2,2) -- (2,2,0) -- cycle;
\filldraw[color=gray!40] (0,2,0) -- (0,2,2) -- (2,2,2) -- (2,2,0) -- cycle;
\draw[very thick] (0,0,0) -- (0,0,2) -- (2,0,2) -- (2,0,0) -- cycle;
\filldraw[color=gray!40] (0,0,0) -- (0,0,2) -- (2,0,2) -- (2,0,0) -- cycle;
\end{tikzpicture}
\end{document}
最新回復
  • 2019-12-5
    1 #

    在你的構造中,通過在填充後绘製虛線,我们有一个類似於你想要的數字。

    \documentclass[letterpaper, 12pt]{article}
    \usepackage[margin = 1in]{geometry}
    \usepackage[spanish]{babel}
    %\usepackage[utf8]{inputenc}
    \usepackage{tikz}
    \usetikzlibrary{positioning}
    %\usepackage{pgfplots}
    %\pgfplotsset{compat=1.15}
    \usepackage{xcolor}
    \begin{document}
    \begin{tikzpicture}
    
    \draw[very thick] (0,2,0) -- (0,2,2) -- (2,2,2) -- (2,2,0) -- cycle;
    \filldraw[color=gray!40] (0,2,0) -- (0,2,2) -- (2,2,2) -- (2,2,0) -- cycle;
    \draw[very thick] (0,0,0) -- (0,0,2) -- (2,0,2) -- (2,0,0) -- cycle;
    \filldraw[color=gray!40] (0,0,0) -- (0,0,2) -- (2,0,2) -- (2,0,0) -- cycle;
    
    \draw[dashed] (2,0,0) -- (2,2,0) node[midway,right] {$L$};
    \draw [dashed] (0,2,2) -- (0,0,2);
    \draw[dashed] (0,0,0) -- (0,2,0);
    \draw [dashed] (2,0,2) -- (2,2,2);
    \end{tikzpicture}
    \end{document}
    

  • 2019-12-5
    2 #

    類似這个?

    \documentclass[letterpaper, 12pt]{article}
    \usepackage[margin = 1in]{geometry}
    \usepackage[spanish]{babel}
    \usepackage[utf8]{inputenc}
    \usepackage{tikz}
    \usetikzlibrary{positioning}
    \usepackage{pgfplots}
    \pgfplotsset{compat=1.15}
    \usepackage{xcolor}
    \pgfmathsetmacro{\a}{7} %  
    \pgfmathsetmacro{\b}{4} % 
    \pgfmathsetmacro{\teta}{125}
    \begin{document}
    \begin{tikzpicture}[
    x={(1cm,0cm)},
    y={({cos(\teta)*1cm}, {sin(\teta)*1cm})},
    z={(0cm,1cm)},
    ]
    \coordinate (A) at (0,0,0); 
    \coordinate (B) at (\a,0,0); 
    \coordinate (C) at (\a,\b,0); 
    \coordinate (D) at (0,\b,0); 
    \begin{scope}[shift={(\b,\a)}]
    \coordinate (E) at (0,0,0); 
    \coordinate (F) at (\a,0,0); 
    \coordinate (G) at (\a,\b,0); 
    \coordinate (H) at (0,\b,0);
    \end{scope}
    \draw[ultra thick,fill=pink] (A) -- (B)  -- (C) -- (D) --cycle;
    \draw[ultra thick,fill=pink] (E) -- (F)  -- (G) -- (H) --cycle;
    \path (B)--(D)node[midway]{\huge $i$};
    \path (F)--(H)node[midway]{\huge $j$};
    \draw [ultra thick, dashed](A)--(B)node[midway,below]{\huge $X$};
    \draw [ultra thick, dashed](A)--(D)node[midway,left=2mm]{\huge $Y$};
    \draw [ultra thick, dashed](D)--(H)node[midway,left]{\huge $L$};
    \draw [ultra thick, dashed](A)--(E) (B)--(F) (C)--(G);
    \end{tikzpicture}
    \end{document}
    

  • 定製beamer塊高度
  • LaTeX sectioning:無法將子列更改為使用titlesec執行