scrbook e \ref

  • Creatore
    Topic
  • #12730
    Up
    0
    Down
    ::


    Ciao a tutti,
    vi espongo il mio problema:
    1- utilizzo la classe scrbook di KOMA-script
    2- inserisco 2 figure nel testo
    3- nelle caption ottengo “Figure 1.1” e “Figure 1.2” : tutto bene!
    4- quando invece vado a fare il riferimento nel testo ottengo per entrambe “Figure 1.1” e “Figure 1.1” : Problema!!!
    5- Il problema non sussiste nel caso dell’utilizzo di subfigure cioè ottengo correttamente “Figure 1.1 (a) e 1.1(b)” e “Figure 1.2 (a) e 1.2 (b)”.

    Allego il mio preambolo + codice minimale del capitolo1
    (Per completezza utilizzo SuSE Linux 9.3)

    `
    % *****************************************************************
    \documentclass[a4paper,twoside,BCOR12mm,DVI15,openright,%
    12pt,cleardoubleempty,chapterprefix]{scrbook}
    % *****************************************************************
    % Setting text body
    % *****************************************************************
    \usepackage{setspace}
    \typearea[current]{current}
    \areaset[12mm]{16cm}{23.5cm}
    % *****************************************************************
    \usepackage[english]{babel}
    %\usepackage[latin1]{inputenc} % latin utf8
    %\usepackage[T1]{fontenc}
    % *****************************************************************
    % Taking care of Figures, Sub-figures and Captions
    % *****************************************************************
    \usepackage[dvips]{graphicx}
    \usepackage[font=small,labelfont=bf,textfont=it]{caption}[2004/07/16]
    \usepackage{subfigure}
    \usepackage{float}
    % *****************************************************************
    \usepackage{placeins}
    \usepackage{fancyhdr}
    % *****************************************************************
    % Enabling Math and Units
    % *****************************************************************
    \usepackage{bm}
    \usepackage{amsfonts}
    \usepackage{amsmath}
    \usepackage{amssymb}
    \usepackage[amssymb]{SIunits}
    \usepackage{latexsym}
    % *****************************************************************
    %
    %
    \tolerance 1414
    \hbadness 1414
    \emergencystretch 1.5em
    \hfuzz 0.3pt
    \widowpenalty=10000
    \vfuzz \hfuzz
    % *****************************************************************
    % Commands for redifining “Big-Headings''
    % *****************************************************************
    \setkomafont{part}{\normalfont\Huge\bfseries}
    \setkomafont{partnumber}{\normalfont\huge\bfseries}
    \setkomafont{chapter}{\normalfont\huge\bfseries}
    \setkomafont{section}{\normalfont\Large\bfseries}
    \setkomafont{subsection}{\normalfont\large\bfseries}
    \setkomafont{subsubsection}{\normalfont\normalsize\bfseries}
    \setkomafont{paragraph}{\normalfont\normalsize\bfseries}
    \setkomafont{subparagraph}{\normalfont\normalsize\bfseries}
    \setkomafont{sectioning}{\normalfont\bfseries}
    \setkomafont{pagenumber}{\bfseries}
    % *****************************************************************
    \pagestyle{fancy}
    \restylefloat{figure}
    \restylefloat{table}
    %
    \renewcommand{\chaptermark}[1]{\markboth{#1}{}}
    %\renewcommand{\chaptermark}[1]{\markboth{\chaptername\ \thechapter.\ #1}{}}
    %\renewcommand{\sectionmark}[1]{\markright{#1}}%Paolo
    \lhead[\fancyplain{}{\bfseries\thepage}]%
    {\fancyplain{}{\bfseries\leftmark}}
    \rhead[{\fancyplain{}{\bfseries\leftmark}}]%
    {\fancyplain{}{\bfseries\thepage}}
    \cfoot{}
    %
    % *****************************************************************
    % Where to look for graphics
    % *****************************************************************
    \graphicspath{{gfx/}}
    % *****************************************************************
    % Hyper-references
    % *****************************************************************
    %
    % *****************************************************************
    % Hyphenation
    % *****************************************************************
    %\hyphenation{put special hyphenation here}
    % *****************************************************************
    %
    % BEGIN of DOCUMENT
    %
    % *****************************************************************
    \begin{document}
    % *****************************************************************
    % Frontmatter
    % *****************************************************************
    \include{Frontbackmatter/title}
    %\cleardoubleemptypage\include{Frontbackmatter/dedication}
    %\cleardoubleemptypage\include{Frontbackmatter/acknowledgments}
    \cleardoubleemptypage
    \pagenumbering{roman}
    \begin{tableofcontents}
    \cleardoubleemptypage
    \pagenumbering{arabic}
    %\setcounter{page}{1}
    % *****************************************************************
    % Mainmatter
    % *****************************************************************
    \include{Chapters/cap1}
    \cleardoubleemptypage
    % *****************************************************************
    % Backmatter
    % *****************************************************************
    \addcontentsline{toc}{chapter}{References}
    \include{Frontbackmatter/biblio}
    \end{tableofcontents}
    % *****************************************************************
    %
    % END of DOCUMENT
    %
    % *****************************************************************
    \end{document}
    % *****************************************************************
    `

    `
    \chapter{PIPPO}
    \label{chap:1}

    \section{Sezione}
    As shown in \figurename~\ref{fig:spc01}.
    \begin{figure}[tbp]
    \label{fig:spc01}%
    \centering%
    \includegraphics[keepaspectratio,scale=0.8]{c01/img01}%
    \caption{descrizione}%
    \end{figure}
    As shown in \figurename~\ref{fig:spc02}.
    \begin{figure}[htbp]
    \label{fig:spc02}%
    \centering%
    \includegraphics[keepaspectratio,scale=1.0]{c01/img02}%
    \caption{descrizione}%
    \end{figure}
    `

    Spero di essere stato chiaro nell’esposizione del problema.
    Grazie a tutti in anticipo

Visualizzazione 1 filone di risposte
  • Autore
    Risposte
    • #12731
      lorenzo.pantieri
      Partecipante
        Up
        0
        Down
        ::


        Metti \label{…} dopo la corrispondente caption.
        `\documentclass{scrbook}

        \usepackage{graphicx}

        \begin{document}

        \chapter{Prova}

        As shown in \figurename~\ref{mac}.

        \begin{figure}[th]
        \centering
        \includegraphics[width=0.3\textwidth]{Mac}
        \caption{Dida.}
        \label{mac}
        \end{figure}

        As shown in \figurename~\ref{sed}.

        \begin{figure}[th]
        \centering
        \includegraphics[width=0.3\textwidth]{Sed}
        \caption{Dida.}
        \label{sed}
        \end{figure}

        \end{document}
        `
        Ciao,
        L.

      • #12732
        Up
        0
        Down
        ::


        Grazie!!!
        Funziona senza alcun problema! 😀

    Visualizzazione 1 filone di risposte
    • Devi essere connesso per rispondere a questo topic.

    Go to top