Composizione errata di un titolo

  • Creatore
    Topic
  • #37046
    Up
    0
    Down
    ::


    Esempio minimo compilabile:
    `\documentclass[a4paper,twoside]{memoir}

    \usepackage{ucs}
    \usepackage[utf8x]{inputenc}
    \usepackage[T1]{fontenc}
    \usepackage[english,italian]{babel}

    \usepackage{listings}

    \lstset{
    basicstyle=\small\ttfamily,
    showspaces=false,
    showstringspaces=false,
    breaklines=true}
    \lstloadlanguages{PHP,XML}

    \setcounter{tocdepth}{4}
    \setcounter{secnumdepth}{3}

    \usepackage[top=2cm,bottom=2.5cm,left=2cm,right=2cm, bindingoffset=1cm]{geometry}
    \usepackage[unicode=true,pdfview=FitH,pdfstartview=FitH,colorlinks=false]{hyperref}

    \begin{document}

    \subsection{Loading XML Data Using \texttt{simplexml\_load\_file}}

    This function is typically used for loading XML data either from a file, or a remote call. In this example, we will load a flat XML file:

    \begin{lstlisting}[language=PHP]

    \end{lstlisting}

    That's it. No need to clean anything up, PHP will take care of that for you.

    \subsection{Loading XML Using \texttt{simplexml\_load\_string}}

    \begin{lstlisting}[language=PHP]



    Mustang


    Accord


    ';
    $xml = simplexml_load_string($xml);
    ?>
    \end{lstlisting}

    Pretty easy, huh? This function loads an XML string and returns and instance of SimpleXMLElement. You could also directly instantiate the \lstinline!SimpleXMLElement! class a similar way, as demonstrated below.

    \subsection{Loading XML Using the \texttt{SimpleXMLElement} Class}

    \begin{lstlisting}[language=PHP]



    Mustang


    Accord


    ';
    $xml = new SimpleXMLElement($xml);
    ?>
    \end{lstlisting}

    It's your choice on using this method, or \lstinline!simplexml_load_string!.

    \end{document}
    `
    Si tratta di una serie di copia-incolla presi da internet per crearmi un manualetto completo di una serie di funzioni PHP che nel sito del medesimo non sono documentate.
    Ho tolto quello che c’era prima e che comunque viene correttamente composto. Succede che fino al penultimo ‘\subsection’, i sottotitoli vengono correttamente distanziati dal paragrafo precedente. Da quel punto in poi i sottotitoli escono attaccati al paragrafo precedente.
    Se elimino l’ultmo ‘\begin{lstlisting}’, la spaziatura torna normale, sino ad un nuovo ambiente ‘lstlisting’, quando il problema si ripresenta.
    Note:
    1) il problema si manifesta anche cambiando ‘subsection’ con ‘section’ o ‘subsubsection’.
    2) ci sono decine di ‘lstlisting’ prima di questo. Non è che ‘listings’ ha un limite?
    3) ho provato anche article e scrreprt. Tutti danno lo stesso problema.
    Dove sbaglio?

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

      Esempio minimo compilabile:
      `\documentclass[a4paper,twoside]{memoir}

      \usepackage{ucs}
      \usepackage[utf8x]{inputenc}
      \usepackage[T1]{fontenc}
      \usepackage[english,italian]{babel}

      \usepackage{listings}

      \lstset{
      basicstyle=\small\ttfamily,
      showspaces=false,
      showstringspaces=false,
      breaklines=true}
      \lstloadlanguages{PHP,XML}

      \setcounter{tocdepth}{4}
      \setcounter{secnumdepth}{3}

      \usepackage[top=2cm,bottom=2.5cm,left=2cm,right=2cm, bindingoffset=1cm]{geometry}
      \usepackage[unicode=true,pdfview=FitH,pdfstartview=FitH,colorlinks=false]{hyperref}

      \begin{document}

      \subsection{Loading XML Data Using \texttt{simplexml\_load\_file}}

      This function is typically used for loading XML data either from a file, or a remote call. In this example, we will load a flat XML file:

      \begin{lstlisting}[language=PHP]

      \end{lstlisting}

      That's it. No need to clean anything up, PHP will take care of that for you.

      \subsection{Loading XML Using \texttt{simplexml\_load\_string}}

      \begin{lstlisting}[language=PHP]



      Mustang


      Accord


      ';
      $xml = simplexml_load_string($xml);
      ?>
      \end{lstlisting}

      Pretty easy, huh? This function loads an XML string and returns and instance of SimpleXMLElement. You could also directly instantiate the \lstinline!SimpleXMLElement! class a similar way, as demonstrated below.

      \subsection{Loading XML Using the \texttt{SimpleXMLElement} Class}

      \begin{lstlisting}[language=PHP]



      Mustang


      Accord


      ';
      $xml = new SimpleXMLElement($xml);
      ?>
      \end{lstlisting}

      It's your choice on using this method, or \lstinline!simplexml_load_string!.

      \end{document}
      `
      Si tratta di una serie di copia-incolla presi da internet per crearmi un manualetto completo di una serie di funzioni PHP che nel sito del medesimo non sono documentate.
      Ho tolto quello che c’era prima e che comunque viene correttamente composto. Succede che fino al penultimo ‘\subsection’, i sottotitoli vengono correttamente distanziati dal paragrafo precedente. Da quel punto in poi i sottotitoli escono attaccati al paragrafo precedente.
      Se elimino l’ultmo ‘\begin{lstlisting}’, la spaziatura torna normale, sino ad un nuovo ambiente ‘lstlisting’, quando il problema si ripresenta.
      Note:
      1) il problema si manifesta anche cambiando ‘subsection’ con ‘section’ o ‘subsubsection’.
      2) ci sono decine di ‘lstlisting’ prima di questo. Non è che ‘listings’ ha un limite?
      3) ho provato anche article e scrreprt. Tutti danno lo stesso problema.
      Dove sbaglio?

      Non devi usare l’ambiente lstlisting direttamente dopo un titolo di sezione. Oppure scrivere
      `\makeatletter\@nobreakfalse\makeatother`
      dopo l’ambiente lstlisting. Ti consiglio di precederli sempre con un testo.

      Ciao
      Enrico

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

Go to top