Re: Cornice immagini

#81232
Up
0
Down
::

carlo2002″ post=80462Ho provato così ma non funzione
`\documentclass[a4paper,11pt]{book}
\usepackage[italian]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{tikz}
\usetikzlibrary{shadows}
\tikzset{riquadro 1/.style={inner sep=2pt,draw, fill=white,drop shadow}}
\tikzset{riquadro 2/.style={inner sep=2pt,draw, fill=white,copy shadow}}
\tikzset{riquadro 3/.style={inner sep=2pt,draw, fill=white,double copy shadow}}

\newcommand{\usariquadro}[1]{\tikzset{riquadro/.style={#1}}}
\newcommand{\riquadraombreggia}[2][]{
\tikzset[baseline=-0.5ex]\node[riquadro]{\includegraphics[#1]{#2}};
}

\title{File di prova}
\author{me stesso}
\date{}

\begin{document}
\maketitle

\chapter{Prova di un documento Latex}

\section{Immagine con ombreggiatura}

\begin{center}
\riquadraombreggia[width=10cm]{immagine_01.png}
\end{center}

\end{document}`

Questo è il messaggio di errore che ottengo
`! Package pgfkeys Error: I do not know the key '/tikz/[' and I am going to igno
re it. Perhaps you misspelled it.
See the pgfkeys package documentation for explanation.
Type H for immediate help.

l.29 …adraombreggia[width=10cm]{immagine_01.png}
This error message was generated by an \errmessage
command, so I can't give any explicit help.
Pretend that you're Hercule Poirot: Examine all clues,
and deduce the truth by order and method.
! Undefined control sequence.
\\riquadraombreggia …set [baseline=-0.5ex]\node
[riquadro]{\includegraphic…
l.29 …adraombreggia[width=10cm]{immagine_01.png}
The control sequence at the end of the top line
of your error message was never \def'ed. If you have
misspelled it (e.g., `\hobx'), type `I' and the correct
spelling (e.g., `I\hbox'). Otherwise just continue,
and I'll forget about whatever was undefined.

File: immagine_01.png Graphic file (type png)

Overfull \hbox (1.35847pt too wide) in paragraph at lines 29–30
\T1/cmr/m/n/10.95 0.5ex][riquadro][];
[]
[3 <./immagine_01.png (PNG copy)>] (./prova.aux) )
Here is how much of TeX's memory you used:
8161 strings out of 493848
139396 string characters out of 1152823
189996 words of memory out of 3000000
11266 multiletter control sequences out of 15000+50000
13670 words of font info for 33 fonts, out of 3000000 for 9000
714 hyphenation exceptions out of 8191
47i,6n,69p,338b,198s stack positions out of 5000i,500n,10000p,200000b,50000s`

I problemi sono due:

1) questo codice: `
\newcommand{\riquadraombreggia}[2][]{
\tikzset[baseline=-0.5ex]\node[riquadro]{\includegraphics[#1]{#2}};
}
` non va bene perché devi usare il comando [tt]\tikz[/tt] per inserire un nodo e non [tt]\tikzset[/tt] che semplicemente definisce delle opzioni;

2) se definisci `\newcommand{\usariquadro}[1]{\tikzset{riquadro/.style={#1}}}` ma poi non lo usi almeno una volta per impostare il default ecco che il nodo precedentemente definito non sa quale sia lo stile [tt]riquadro[/tt].

Ecco quindi il tuo codice corretto:`
\documentclass[a4paper,11pt]{book}
\usepackage[italian]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

\usepackage{tikz}
\usetikzlibrary{shadows}
\tikzset{riquadro 1/.style={inner sep=2pt,draw, fill=white,drop shadow}}
\tikzset{riquadro 2/.style={inner sep=2pt,draw, fill=white,copy shadow}}
\tikzset{riquadro 3/.style={inner sep=2pt,draw, fill=white,double copy shadow}}

\newcommand{\usariquadro}[1]{\tikzset{riquadro/.style={#1}}}
\usariquadro{riquadro 1}
\newcommand{\riquadraombreggia}[2][]{
\tikz[baseline=-0.5ex]\node[riquadro]{\includegraphics[#1]{#2}};
}

\title{File di prova}
\author{me stesso}
\date{}

\begin{document}
\maketitle

\chapter{Prova di un documento Latex}

\section{Immagine con ombreggiatura}

\begin{center}
\riquadraombreggia[width=10cm]{foto}
\end{center}

\end{document}
`

Ciao
Claudio

Go to top