Re: Il disegno programmato nell’Arte di scrivere con LaTeX

#72660
Up
0
Down
::

lorenzo.pantieri” post=721382.
Qual è la chiave corrispondente al valore “thick”? In altre parole: “blue” è come dire “color=blue”; “thick” a che cosa è equivalente?

Ti posso rispondere in merito a questo. 🙂 La parola chiave thick corrisponde a scrivere:

`\draw[line width=0.8pt](0,0)–(1,0);`
Informazioni complete su tutte le parole chiave riguardanti lo spessore dei segmenti le trovi nella sottosezione 15.3.1 Graphic Parameters: Line Width, Line Cap, and Line Join.

Per il colore, no la relazione non è corretta. Se scrivo:

`\draw[blue](0,0)–(1,0) node

{Ciao};`
automaticamente anche la label “Ciao” diventa blu. Come mai? Perché definire un colore nelle opzioni automaticamente definisce: 1) colore del segmento, 2) colore del riempimento, 3) colore del testo. L’analogo di:

`\draw[blue](0,0)–(1,0) node

{Ciao};`
è:

`\draw[draw=blue,text=blue](0,0)–(1,0) node

{Ciao};`
Quello che si fa di solito è definire la colorazione in modo generale e poi cambiare solo la parte che serve. Ad esempio, per far si che la label “Ciao” sia rossa mantenendo il segmento blu:

`\draw[blue,text=red](0,0)–(1,0) node

{Ciao};`
Se invece volessi costruire un box con segmento per il bordo blu, riempimento con blu sfumato e testo rosso al centro:

`\draw[blue,fill= blue!10,text=red](0,0)–(1,0)–(1,0.5)–(0,0.5)–(0,0) node[above right]{Ciao};`

EDIT: ho trovato una spiegazione migliore su come impostare i colori. Riporto due commenti di Andrew Stacey da questa risposta:

When you use color=black then that is a meta-command which sets all colours to black: line colour, fill colour, and text colour. If you want to override any of those then you have to reset it afterwards.
The order of doing things is more commonly important than not. That 2+3 = 3+2 ought to be surprising – the fact that it isn’t is merely because we’re so familiar with it that we don’t notice the oddity. But almost everywhere else, order matters. In Norway there is a children’s song which translates roughly to: “Open window, look out – hello weather, how are you?”. Imagine the difference if you first put your head out of the window and then opened it.

Ciao
Claudio

Go to top