Document ClassesEdges not dashed

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
paulosousa
Posts: 90
Joined: Sun Jun 24, 2012 8:48 pm

Edges not dashed

Post by paulosousa »

Hi all,
Need some help, why [OE], [OA] e [OC] are not appearing dash?

Code: Select all

\documentclass[12pt, twoside, a4paper]{article}
\usepackage[portuguese]{babel}
\usepackage[applemac]{inputenc}
\usepackage[left=2.0cm,top=1.5cm,right=2.0cm,bottom=1.75cm]{geometry}
\usepackage{amsmath,amssymb,amsfonts,textcomp,setspace,color,graphicx, graphics}
\usepackage{pgf,tikz}

\pagestyle{empty}

\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{patterns}

\begin{tikzpicture}[scale=1,cm={-1,-1,1,0,(0,0)},x=3.85mm,z=-1cm]
    %draw the axes (x-axis: towards you; y-axis: to the right; z-axis: up)
    \draw[thick,->,black] (0,0,0) -- (5,0,0) node[anchor=north east]{$x$};
    \draw[thick,->] (0,0,0) -- (0,5,0) node[anchor=north east]{$y$};
    \draw[thick,->] (0,0,0) -- (0,0,6) node[anchor=east]{$z$};

	%draw the top and bottom of the parallelepiped	
	\draw[dashed] (0,0,0) -- (0,3,0);
	\draw[dashed] (0,0,0) -- (3,0,0);
	\draw[very thick] (3,0,0) -- (3,3,0);
	\draw[very thick] (0,3,0) -- (3,3,0);
	\draw[very thick] (3,0,5) -- (0,0,5);
	\draw[very thick] (0,0,5) -- (0,3,5);
	\draw[very thick] (0,3,5) -- (3,3,5);
	\draw[very thick] (3,0,5) -- (3,3,5);
	
	%draw the edges of the parallelepiped
	\draw[very thick] (0,3,0) -- (0,3,5);
	\draw[very thick] (3,0,0) -- (3,0,5);
	\draw[very thick] (3,3,0) -- (3,3,5);
	
	%draw dashed lines to represent hidden edges
	\draw[dashed] (0,0,0) -- (0,0,5);

        %nodes and edge labels
	\draw (-0.15,-0.30,0) node {O};
	\draw (2.90,-0.30,0) node {A};
	\draw (3.60,3.20,0) node {B};
	\draw (0,3.20,0.20) node {C};
	\draw (0,3.20,5.15) node {D};
	\draw (0,-0.20,5.15) node {E};
	\draw (3,-0.20,5.15) node {F};
	\draw (3,3.25,4.85) node {G};

\end{tikzpicture}

Recommended reading 2024:

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

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

User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Edges not dashed

Post by Johannes_B »

Try the following line(s)

Code: Select all

        %draw dashed lines to represent hidden edges
        \draw[dashed,color=orange,ultra thick] (0,0,0) -- (0,0,5);
Do you notice something? If you are absolutely sure that you will have a white background at the end, you could just set the color of the line wo white. Ugly, but ok.

On the other hand, there might be an easier solution hidden in some library. Unfortunately, i don't know TikZ well.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
paulosousa
Posts: 90
Joined: Sun Jun 24, 2012 8:48 pm

Edges not dashed

Post by paulosousa »

Thanks a lot for the excellent idea:

this is very fine:

Code: Select all

\draw[dashed,color=white,ultra thick] (0,0,0) -- (0,0,5);
User avatar
Johannes_B
Site Moderator
Posts: 4182
Joined: Thu Nov 01, 2012 4:08 pm

Re: Edges not dashed

Post by Johannes_B »

Just to be sure, you know why the line did not appear to be dashed before?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10320
Joined: Mon Mar 10, 2008 9:44 pm

Re: Edges not dashed

Post by Stefan Kottwitz »

It was just the axis line towards z which was in the background of the dashed line, so the gaps in the dashed line showed the axis, which is black too.

Stefan
LaTeX.org admin
Post Reply