Graphics, Figures & TablesTikZ | Configuration of Example

Information and discussion about graphics, figures & tables in LaTeX documents.
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

TikZ | Configuration of Example

Post by svend_tveskaeg »

Hi all.

The example here is just great (and even better with the implementation in the comment).

I would, however, like to have all the sides on a cube in the same color but have the color change in each layer of cubes. (I hope it makes sense.)

I have never used TikZ (and I do not have the time to learn it at the moment), so I would be very glad if someone would change the code for me.

Thank you in advance!
Last edited by svend_tveskaeg on Tue Oct 09, 2012 9:24 pm, edited 1 time in total.
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

TikZ | Configuration of Example

Post by svend_tveskaeg »

I am not sure if people are quite because

(1) there is no MWE directly in the thread,
(2) no one can solve my problem, or
(3) something else.

Therefore, I will eliminate the first possibility:

Code: Select all

Code, edit and compile here:
\documentclass{article}
\usepackage[danish]{babel}
\usepackage{ifthenx}
\usepackage{verbatim}
\usepackage{tikz}
% Three counters
\newcounter{x}
\newcounter{y}
\newcounter{z}
% The angles of x,y,z-axes
\newcommand{\xaxis}{210}
\newcommand{\yaxis}{-30}
\newcommand{\zaxis}{90}
% The top side of a cube
\newcommand{\topside}[3]{%
\fill[fill=yellow, draw=black,shift={(\xaxis:#1)},shift={(\yaxis:#2)},
shift={(\zaxis:#3)}] (0,0) -- (30:1) -- (0,1) --(150:1)--(0,0);
}
% The left side of a cube
\newcommand{\leftside}[3]{%
\fill[fill=red, draw=black,shift={(\xaxis:#1)},shift={(\yaxis:#2)},
shift={(\zaxis:#3)}] (0,0) -- (0,-1) -- (210:1) --(150:1)--(0,0);
}
% The right side of a cube
\newcommand{\rightside}[3]{%
\fill[fill=blue, draw=black,shift={(\xaxis:#1)},shift={(\yaxis:#2)},
shift={(\zaxis:#3)}] (0,0) -- (30:1) -- (-30:1) --(0,-1)--(0,0);
}
% The cube
\newcommand{\cube}[3]{%
\topside{#1}{#2}{#3} \leftside{#1}{#2}{#3} \rightside{#1}{#2}{#3}
}
% Definition of \planepartition
\newcommand\planepartition[1]{
\setcounter{x}{-1}
\foreach \a in {#1} {
\addtocounter{x}{1}
\setcounter{y}{-1}
\foreach \b in \a {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

Re: TikZ | Configuration of Example

Post by localghost »

You seem to assume that those who are able to help always can invest their time especially in your problems. That is not the case. m(


Thorsten
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

TikZ | Configuration of Example

Post by svend_tveskaeg »

localghost wrote:You seem to assume that those who are able to help always can invest their time ...
No I do not. That is why I wrote (3).
localghost wrote:... especially in your problems
If I have given that impression in my previous posts, I apologise. That was not my indend.

P.S. I am glad whenever someone helps me. As I said before, I just tried to eliminate one of the possible reason why my post was not answered.
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

TikZ | Configuration of Example

Post by cgnieder »

My bet would be the following sentence:
I would be very glad if someone would change the code for me.
Questions that sound like “please do it for me” are very unlikely to be answered, the more so the more direct they are (even if they are more honest that way and regardless of the reasons behind them...). At least that's my experience.

Regards
site moderator & package author
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

TikZ | Configuration of Example

Post by svend_tveskaeg »

That makes sense.

However, I have no intend of people coming foreward afterwards and claming that they were duped; I am telling it at it is. If that means that I will not get any help, then so be it.

Since I do now know TikZ at all and really like the code above with the alternation that I mentioned, that is how I do it.
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
User avatar
localghost
Site Moderator
Posts: 9201
Joined: Fri Feb 02, 2007 12:06 pm

TikZ | Configuration of Example

Post by localghost »

And because you are so impatient, you have posted this also on {TeX} SX? Our administrator has written down some interesting thoughts in this regard.
[url=http://www.latex-community.org/forum/viewtopic.php?f=37&t=5838]Board Rules[/url] (Section 4.1) wrote:A crossposting is always contra-productive. But there is nothing really against it as long as it is mentioned. This means that a direct link has to be added. So other users who want to help are preserved from double efforts and waste of time.
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes[/size]

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

TikZ | Configuration of Example

Post by cgnieder »

However, I have an (untested) idea: change all colors (yellow, blue, red) into cubecolor and add

Code: Select all

\colorlet{cubecolor}{red!\c0}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
(or similar) right beneath

Code: Select all

\addtocounter{z}{1}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
This should draw each layer in a different shade of red.

Regards
site moderator & package author
User avatar
Stefan Kottwitz
Site Admin
Posts: 10303
Joined: Mon Mar 10, 2008 9:44 pm

TikZ | Configuration of Example

Post by Stefan Kottwitz »

Very good, Clemens! I tested it, and this gives:
cubes.png
cubes.png (12.4 KiB) Viewed 5672 times
Perhaps post it to the other site. If you don't have TeX at hand to compile, just use this image there as well.

Stefan
LaTeX.org admin
User avatar
cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

TikZ | Configuration of Example

Post by cgnieder »

Stefan_K wrote:Perhaps post it to the other site.
I have, together with a second idea I had.
site moderator & package author
Post Reply