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 Hfor 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)
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