[RISOLTO] Cornice immagini

  • Creatore
    Topic
  • #81228
    carlo
    Partecipante
      Up
      0
      Down
      ::


      Devo inserire delle immagini i formato .png e siccome hanno lo sfondo bianco dovrei contornarle in qualche modo.

      Per inserire l’immagine uso

      `\begin{center}
      \includegraphics[width=15cm]{prova_01.png}
      \end{center}`

      Sarebbe anche bello mettere una cornice con ombreggiatura, su una guida ho letto che si può usare \psshadowbox

      ma sinceramente non ho capito come 😕

      (Sto usando una derivata Ubuntu)

    Visualizzazione 4 filoni di risposte
    • Autore
      Risposte
      • #81229
        Up
        0
        Down
        ::

        carlo2002″ post=80452Devo inserire delle immagini i formato .png e siccome hanno lo sfondo bianco dovrei contornarle in qualche modo.

        Per inserire l’immagine uso

        `\begin{center}
        \includegraphics[width=15cm]{prova_01.png}
        \end{center}`

        Sarebbe anche bello mettere una cornice con ombreggiatura, su una guida ho letto che si può usare \psshadowbox

        ma sinceramente non ho capito come 😕

        (Sto usando una derivata Ubuntu)

        Una soluzione con TikZ:
        `
        \documentclass[11pt,a4paper]{article}
        \usepackage{tikz}
        \usetikzlibrary{shadows}
        % alcuni stili… diciamo predefiniti: si differenziano per il tipo di ombreggiatura
        \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}}

        % comando per impostare il tipo di riquadro
        \newcommand{\usariquadro}[1]{\tikzset{riquadro/.style={#1}}}
        % ad esempio
        \usariquadro{riquadro 1}

        % comando per inserire la figura con riquadro ed ombreggiatura
        \newcommand{\riquadraombreggia}[2][]{
        \tikz[baseline=-0.5ex]\node[riquadro]{\includegraphics[#1]{#2}};
        }

        \begin{document}
        % uso lo stile di default: il riquadro 1
        \begin{center}
        \riquadraombreggia[width=5cm]{foto}
        \end{center}

        \usariquadro{riquadro 2}
        \begin{center}
        \riquadraombreggia[width=5cm]{foto}
        \end{center}

        \usariquadro{riquadro 3}
        \begin{center}
        \riquadraombreggia[width=5cm]{foto}
        \end{center}

        % Invento un nuovo stile: questo è il modo giusto per personalizzare riquadro ed ombreggiatura (non è bello il risultato, ma è un esempio)
        \tikzset{il mio fantastico riquadro/.style={
        inner sep=2pt,
        draw=blue, dashed, ultra thick,
        fill=white,general shadow={
        shadow scale=1, shadow xshift=.7ex, shadow yshift=-.7ex,
        solid,top color=orange!10, bottom color=orange!90}
        }
        }

        \usariquadro{il mio fantastico riquadro}
        \begin{center}
        \riquadraombreggia[width=5cm]{foto}
        \end{center}
        \end{document}
        ` Il risultato è:

        [attachment=546]Immagine_2012-12-09.jpg[/attachment]

        Ciao
        Claudio

        Attachments:
        You must be logged in to view attached files.
      • #81230
        carlo
        Partecipante
          Up
          0
          Down
          ::


          Grazie, tutto perfetto, non potevo chiedere di meglio

          ma per cortesia piano, sono proprio agli inizi, alla fine mi hai fatto talmente tanti esempi che vado in confusione :mrgreen:

          ragioniamo solo con un riquadro con ombreggiatura

        • #81231
          carlo
          Partecipante
            Up
            0
            Down
            ::


            Ho 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`

          • #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

          • #81233
            carlo
            Partecipante
              Up
              0
              Down
              ::


              Perfetto funziona 😀

              Alla fine ero riuscito a sbagliare anche copiando 😳

              Grazie mille per l’aiuto

          Visualizzazione 4 filoni di risposte
          • Devi essere connesso per rispondere a questo topic.

          Go to top