multirow su due righe

  • Creatore
    Topic
  • #108483
    Up
    0
    Down
    ::


    ciao a tutti, sto tentando di fare una tabella in cui una colonna sia su “due righe” e l’altra su “tre righe”. Le due righe di sx devono essere centrate sulle tre di dx. Allo scopo sto provando ad usare `multirow`, ma usando il comando `\\` come da pacchetto `multirow` ottengo un messaggio di errore. Allego un codice minimo.

    `\documentclass[a4paper,10pt]{article} % Default font size and paper size

    \usepackage{multirow}

    \usepackage{fontspec} % For loading fonts
    \defaultfontfeatures{Mapping=tex-text}
    \setmainfont[SmallCapsFont = Fontin SmallCaps]{Fontin} % Main document font

    \usepackage{xunicode,xltxtra,url,parskip} % Formatting packages

    \usepackage[usenames,dvipsnames]{xcolor} % Required for specifying custom colors

    %\usepackage[big]{layaureo} % Margin formatting of the A4 page, an alternative to layaureo can be
    % To reduce the height of the top margin uncomment: \addtolength{\voffset}{-1.3cm}

    \usepackage{fullpage}

    \usepackage{hyperref} % Required for adding links and customizing them
    \definecolor{linkcolour}{rgb}{0,0.2,0.6} % Link color
    \hypersetup{colorlinks,breaklinks,urlcolor=linkcolour,linkcolor=linkcolour} % Set link colors throughout the document

    \usepackage{titlesec} % Used to customize the \section command
    \titleformat{\section}{\Large\scshape\raggedright}{}{0em}{}[\titlerule] % Text formatting of sections
    \titlespacing{\section}{0pt}{3pt}{3pt} % Spacing around sections

    \usepackage{ragged2e}

    \usepackage{booktabs}
    \usepackage{collcell}
    \newcommand*{\movedown}[1]{%
    \smash{\raisebox{-1ex}{#1}}}
    \newcolumntype{q}{>{\collectcell\movedown}r<{\endcollectcell}} % (for "quotient") \begin{document} \pagestyle{empty} % Removes page numbering \font\fb=''[cmr10]'' % Change the font of the \LaTeX command under the skills section \begin{tabular}{ll p{12.25cm}} & \multirow{3}*{\textsc{December} 2016 - \textsc{September} 2012 } & \large{\textbf{Ph.D. in Chemical Sciences and Engineering}} \\ & & University of Paperopoli; \\ & & Laboratory of Qui Quo Qua \\ & & \\ \end{tabular} \end{document}` cambiando la linea `& \multirow{3}*{\textsc{December} 2016 - \textsc{September} 2012 } & \large{\textbf{Ph.D. in Chemical Sciences and Engineering}} \\` con `& \multirow{3}*{\textsc{December} 2016 - \\ \textsc{September} 2012 } & \large{\textbf{Ph.D. in Chemical Sciences and Engineering}} \\` che dovrebbe stampare December 2016 September 2012 su due righe differenti ottengo l’errore.

    Soluzioni?

    Grazie,
    Davide

Visualizzazione 2 filoni di risposte
  • Autore
    Risposte
    • #108484
      OldClaudio
      Partecipante
        Up
        0
        Down
        ::


        Non so perché non ti funzioni e anche a me dia lo stesso errore.

        Comunque questo codice funziona; leggi anche i commenti e in futuro cerca di non prelevare template che non sai esattamente che cosa facciano (e magari sono anche obsoleti)`% !TEX TS-program = XeLaTeX
        % !TEX encoding = UTF-8 Unicode
        \documentclass[a4paper,10pt]{article} % Default font size and paper size

        \usepackage{multirow}

        \usepackage{fontspec} % For loading fonts
        \defaultfontfeatures{Mapping=tex-text}
        %\setmainfont[SmallCapsFont = Fontin SmallCaps]{Fontin} % Main document font
        % La riga prima è commentata perché Fontin non è un font che hanno tutti;
        % io non ce l'ho. Negli esempi minimimi compilabili non si devono mettere cose
        % personali, altrimenti non sono più compilabili dagli altri.

        \usepackage{xunicode,xltxtra,url,parskip} % Formatting packages
        % i primi due pacchetti non sono più
        % da caricare.

        \usepackage[usenames,dvipsnames]{xcolor} % Required for specifying custom colors

        %\usepackage[big]{layaureo} % Margin formatting of the A4 page, an alternative to layaureo can be
        % To reduce the height of the top margin uncomment: \addtolength{\voffset}{-1.3cm}

        \usepackage{fullpage}% produce \textwidth= 210mm-2pollici circa= 159,2mm
        % con la terza colonna di 12.25cm = 122.5mm
        % la tabella esce dalla pagina di circa 12mm
        % Invece si potrebe caricare il pacchetto tabularx
        % e definire l'ultima colonna con il descrittore X:
        % \begin{tabularx{\textwidth}{llX}
        % ma a che cosa serve la prima colonna vuota?

        \usepackage{hyperref} % Required for adding links and customizing them
        \definecolor{linkcolour}{rgb}{0,0.2,0.6} % Link color
        % avendo caricato il pacchetto xcolor si possono scegliere
        % i colori per nome e in modo più “intelligente”
        \hypersetup{colorlinks,breaklinks,urlcolor=linkcolour,linkcolor=linkcolour} % Set link colors throughout the document

        \usepackage{titlesec} % Used to customize the \section command
        \titleformat{\section}{\Large\scshape\raggedright}{}{0em}{}[\titlerule] % Text formatting of sections
        \titlespacing{\section}{0pt}{3pt}{3pt} % Spacing around sections

        \usepackage{ragged2e}

        \usepackage{booktabs}

        \usepackage{collcell}
        \newcommand*{\movedown}[1]{%
        \smash{\raisebox{-1ex}{#1}}}
        \newcolumntype{q}{>{\collectcell\movedown}r<{\endcollectcell}} % (for "quotient") \begin{document} \pagestyle{empty} % Removes page header and footer \font\fb=''[cmr10]'' % Change the font of the \LaTeX command under the % skills section % ORRORE, ORRORE, ORRORE. % Perché specificare un font OpenType codificato UNICODE % per poi scrivere qualcosa con il vecchio Computer Modern % con codifica OT1 ? La codifica OT1 non ha le lettere % accentate e manca anche di altri segni \centering \begin{tabular}{llp{10.25cm}}% vedi commento sopra dove carichi fullpage & & \large\bfseries Ph.D. in Chemical Sciences and Engineering \\ &\parbox{30mm}{\scshape December~2016 \newline September~2012}& University of Paperopoli; \\ & & Laboratory of Qui Quo Qua \\ & & \end{tabular} \end{document}`

      • #108485
        Up
        0
        Down
        ::


        grazie della risposta,

        do un occhio e vediamo se funziona! e grazie per i suggerimenti!

        Davide

      • #108486
        Up
        0
        Down
        ::


        La mia regola aurea è “qualsiasi tabella che usi [tt]\multirow[/tt] può essere migliorata togliendolo”. Questo caso è tipico.

        `
        \documentclass[a4paper,10pt]{article} % Default font size and paper size

        \usepackage{fontspec} % For loading fonts
        \setmainfont[SmallCapsFont = Fontin SmallCaps]{Fontin} % Main document font

        \usepackage{url,parskip} % Formatting packages

        \usepackage[usenames,dvipsnames]{xcolor} % Required for specifying custom colors

        \usepackage{fullpage}
        \usepackage{ragged2e}
        \usepackage{array}
        \usepackage{booktabs}
        \usepackage{collcell}
        \usepackage{titlesec} % Used to customize the \section command

        \usepackage{hyperref} % Required for adding links and customizing them

        \definecolor{linkcolour}{rgb}{0,0.2,0.6} % Link color
        \hypersetup{colorlinks,breaklinks,urlcolor=linkcolour,linkcolor=linkcolour} % Set link colors throughout the document

        \titleformat{\section}{\Large\scshape\raggedright}{}{0em}{}[\titlerule] % Text formatting of sections
        \titlespacing{\section}{0pt}{3pt}{3pt} % Spacing around sections

        \newcommand*{\movedown}[1]{%
        \smash{\raisebox{-1ex}{#1}}}
        \newcolumntype{q}{>{\collectcell\movedown}r<{\endcollectcell}} % (for "quotient") \begin{document} \pagestyle{empty} % Removes page numbering \begin{tabular}{@{}ll@{}} \textsc{December} 2016 - \textsc{September} 2012 & \large\textbf{Ph.D. in Chemical Sciences and Engineering} \\ & University of Paperopoli; \\ & Laboratory of Qui Quo Qua \\ \end{tabular} \textsc{December} 2016 - \textsc{September} 2012\quad \begin{tabular}{@{}l@{}} \large\textbf{Ph.D. in Chemical Sciences and Engineering} \\ University of Paperopoli; \\ Laboratory of Qui Quo Qua \\ \end{tabular} \end{document} ` Nota che ho omesso xltxtra e xunicode, non servono e il secondo è addirittura dannoso (o lo sarà in un prossimo futuro). Anche [tt]\defaultfontfeatures{Mapping=tex-text}[/tt] è un residuo del passato. Inoltre hyperref deve essere caricato per ultimo, in particolare dopo titlesec. La riga con [tt]\font\fb=”[cmr10]”[/tt] è quanto di peggio si possa immaginare. Lo so che qualche template l’adopera, non la rende meno scema.

        La mia preferenza va senza dubbio alla prima tabella: non ha senso che le date siano a metà altezza.

        [attachment=1788]ScreenShot2016-11-28at22.42.05.png[/attachment]

        Ciao
        Enrico

        Attachments:
        You must be logged in to view attached files.
    Visualizzazione 2 filoni di risposte
    • Devi essere connesso per rispondere a questo topic.

    Go to top