[RISOLTO]Non c’è spazio tra parole quando c’è newcommand

  • Creatore
    Topic
  • #71145
    Up
    0
    Down
    ::


    Salve a tutti,
    sto scrivendo una tesina e vorrei sapere se qualcuno di voi ha mai incontrato il seguente problema con il comando \newcommand{}{}.
    Dopo che compilo con pdfLaTex, nel pdf, quando il comando in questione è seguito da una congiunzione/preposizione monosillabica (e, con…), questa viene attaccata alla parola del \newcommand. Ad esempio se in tex scrivo “[…] \op e […] “, in pdf lo stampa “Opcodee” mentre dovrebbe essere “Opcode e “; altre volte viene bene. Si può sistemare?
    Questo è il preambolo del report.

    `
    \documentclass[a4paper, 11pt, titlepage, twoside, openright]{report} % use larger type; default would be 10pt; use twocolumn ifneeded

    \usepackage[T1]{fontenc}
    \usepackage[utf8]{inputenc}
    \usepackage{lmodern}

    \usepackage{indentfirst}
    \usepackage[sans]{frontespizio}

    \usepackage{geometry}
    \geometry{margin=2cm} % for example, change the margins to 2 inches all round

    \usepackage{graphicx} % support the \includegraphics command and options
    \graphicspath{{figure/}}
    :
    :
    :
    \newcommand{\mail}[1]{{\texttt{#1}}}
    \newcommand{\server}{server~PCP}
    \newcommand{\client}{client~{PCP} }
    \newcommand{\four}{IPv4}
    \newcommand{\six}{IPv6}
    \newcommand{\pp}{PCP }
    \newcommand{\nat}{{NAT} }
    \newcommand{\upnp}{{UPnP}}
    \newcommand{\oc}{Opcode}
    \newcommand{\op}{Options}

    \begin{document}

    \include{titolo}
    :
    :
    \end{titolo}
    `

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

      Latex_newbie” post=70418Salve a tutti,
      sto scrivendo una tesina e vorrei sapere se qualcuno di voi ha mai incontrato il seguente problema con il comando \newcommand{}{}.
      Dopo che compilo con pdfLaTex, nel pdf, quando il comando in questione è seguito da una congiunzione/preposizione monosillabica (e, con…), questa viene attaccata alla parola del \newcommand. Ad esempio se in tex scrivo “[…] \op e […] “, in pdf lo stampa “Opcodee” mentre dovrebbe essere “Opcode e “; altre volte viene bene. Si può sistemare?
      Questo è il preambolo del report.

      `
      \documentclass[a4paper, 11pt, titlepage, twoside, openright]{report} % use larger type; default would be 10pt; use twocolumn ifneeded

      \usepackage[utf8]{inputenc} % set input encoding (not needed with XeLaTeX)
      \usepackage{textcomp}

      \usepackage{indentfirst}
      \usepackage[sans]{frontespizio}

      \usepackage{geometry}
      \geometry{margin=2cm} % for example, change the margins to 2 inches all round

      \usepackage{graphicx} % support the \includegraphics command and options
      \graphicspath{{figure/}}

      %%% PACKAGES
      \usepackage{amsmath}
      \usepackage{booktabs} % for much better looking tables
      \usepackage{array} % for better arrays (eg matrices) in maths
      \usepackage{paralist} % very flexible & customisable lists (eg. enumerate/itemize, etc.)
      \usepackage{verbatim} % adds environment for commenting out blocks of text & for better verbatim
      \usepackage{subfig} % make it possible to include more than one captioned figure/table in a single float

      \usepackage{fancyhdr} % This should be set AFTER setting up the page geometry
      \pagestyle{fancy} % options: empty , plain , fancy
      \renewcommand{\headrulewidth}{0pt} % customise the layout…
      \lhead{}\chead{}\rhead{}
      \lfoot{}\cfoot{\thepage}\rfoot{}

      %%% SECTION TITLE APPEARANCE
      \usepackage{sectsty}
      \allsectionsfont{\sffamily\mdseries\upshape} % (See the fntguide.pdf for font help)
      % (This matches ConTeXt defaults)

      %%% ToC (table of contents) APPEARANCE
      \usepackage[nottoc,notlof,notlot]{tocbibind} % Put the bibliography in the ToC
      \usepackage[titles,subfigure]{tocloft} % Alter the style of the Table of Contents
      \renewcommand{\cftsecfont}{\rmfamily\mdseries\upshape}
      \renewcommand{\cftsecpagefont}{\rmfamily\mdseries\upshape} % No bold!

      %LANGUAGE + Bibliography with BibTeX
      \usepackage[english,italian]{babel}
      \usepackage[babel]{csquotes}
      \usepackage[style=numeric-comp]{biblatex}
      \bibliography{bibliografia/bibliografia1}

      %HYPERLINK + REFERENCES
      \usepackage{hyperref}
      \hypersetup{pdfstartview=Fit}

      \newcommand{\mail}[1]{{\texttt{#1}}}
      \newcommand{\server}{server~PCP}
      \newcommand{\client}{client~{PCP} }
      \newcommand{\four}{IPv4}
      \newcommand{\six}{IPv6}
      \newcommand{\pp}{PCP }
      \newcommand{\nat}{{NAT} }
      \newcommand{\upnp}{{UPnP}}
      \newcommand{\oc}{Opcode}
      \newcommand{\op}{Options}

      \begin{document}

      \include{titolo}
      :
      :
      \end{titolo}
      `

      Usa:

      `\op{} e il resto del testo.`
      Ciao
      Claudio

    • #71147
      Up
      0
      Down
      ::


      Questo implica che devo compilare più volte il file tex per verificare se nel pdf c’è il giusto spazio dopo il comando oppure no.

      PS: ho accorciato un po’ il mio primo post.

    • #71148
      Up
      0
      Down
      ::

      Latex_newbie” post=70425Questo implica che devo compilare più volte il file tex per verificare se nel pdf c’è il giusto spazio dopo il comando oppure no.

      È il comportamento normale.
      Un comando viene terminato o da un altro comando o da un segno di punteggiatura o da un gruppo. Quindi uno dei seguenti dà il risultato desiderato:
      `
      \op,
      \op{}
      \op\`

      Ciao
      Ivan

    • #71149
      Up
      0
      Down
      ::

      ivan” post=70426
      È il comportamento normale.
      Un comando viene terminato o da un altro comando o da un segno di punteggiatura o da un gruppo. Quindi uno dei seguenti dà il risultato desiderato:
      `
      \op,
      \op{}
      \op\`

      Questo lo ignoravo. Grazie di avermelo detto!

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

Go to top