pgfplotstable: Have every other row be a multicolumn The 2019 Stack Overflow Developer Survey...

How many cones with angle theta can I pack into the unit sphere?

Can the DM override racial traits?

Does Parliament need to approve the new Brexit delay to 31 October 2019?

How to determine omitted units in a publication

How did passengers keep warm on sail ships?

Would an alien lifeform be able to achieve space travel if lacking in vision?

Why can I use a list index as an indexing variable in a for loop?

Do working physicists consider Newtonian mechanics to be "falsified"?

Store Dynamic-accessible hidden metadata in a cell

Why are PDP-7-style microprogrammed instructions out of vogue?

Homework question about an engine pulling a train

What do I do when my TA workload is more than expected?

Intergalactic human space ship encounters another ship, character gets shunted off beyond known universe, reality starts collapsing

Deal with toxic manager when you can't quit

My body leaves; my core can stay

Does Parliament hold absolute power in the UK?

One-dimensional Japanese puzzle

Can withdrawing asylum be illegal?

"is" operation returns false even though two objects have same id

60's-70's movie: home appliances revolting against the owners

Sub-subscripts in strings cause different spacings than subscripts

Can a flute soloist sit?

How to make Illustrator type tool selection automatically adapt with text length

For what reasons would an animal species NOT cross a *horizontal* land bridge?



pgfplotstable: Have every other row be a multicolumn



The 2019 Stack Overflow Developer Survey Results Are In
Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar Manara
Do we need more moderators?Pgfplotstable without headings rowDouble row heading in pgfplotstableExcluding every nth row in pgfplotstableRemove row in table (pgfplotstable)How to plot every 4th row using pgfplotstable?PGFPLOTSTABLE configuration, bold style for headers, specific row, and specific formatting from CSVWhat options are there to globally format tables also allowing local overrides?Multicolumn in pgfplotstable headermulticolumn doesn't count columns property in pgfplotstablepgfplotstable, multicolumn sp












0















I am trying to make a table using pgfplotstable, and am having difficulties because the csv's are jagged. Most rows have 4 columns, as do the headers, but some rows are only 1 column and I would like these 1-cell rows to span the width of the table.



How do I either have pgfplotstable dynamically create multicolumns depending on the csv, or set every other row to be a multicolumn using data from the csv?



mwe (does not produce the proper layout):



documentclass{article}
usepackage{pgfplotstable,multirow,booktabs}

begin{filecontents}{data.csv}
ColumnHeader1, ColumnHeader2, ColumnHeader3, ColumnHeader4
item1, string1, string2, string3
some-text-goes-here
item2, string1, string2, string3
some-more-text-goes-here
end{filecontents}

begin{document}

pgfplotstabletypeset[
col sep = comma,
column type = l,
string type,
multicolumn names,
every head row/.style={before row=toprule, after row=midrule},
every last row/.style={after row=bottomrule},
%every other row/.style = {multicolumn{4}{l}{...}}
]{data.csv}

end{document}









share|improve this question
















bumped to the homepage by Community 1 min ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 1





    Welcome to TeX.SX! Please add a minimal working example (MWE), not not just a fragment. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with documentclass and ending with end{document}

    – albert
    Aug 27 '18 at 17:51
















0















I am trying to make a table using pgfplotstable, and am having difficulties because the csv's are jagged. Most rows have 4 columns, as do the headers, but some rows are only 1 column and I would like these 1-cell rows to span the width of the table.



How do I either have pgfplotstable dynamically create multicolumns depending on the csv, or set every other row to be a multicolumn using data from the csv?



mwe (does not produce the proper layout):



documentclass{article}
usepackage{pgfplotstable,multirow,booktabs}

begin{filecontents}{data.csv}
ColumnHeader1, ColumnHeader2, ColumnHeader3, ColumnHeader4
item1, string1, string2, string3
some-text-goes-here
item2, string1, string2, string3
some-more-text-goes-here
end{filecontents}

begin{document}

pgfplotstabletypeset[
col sep = comma,
column type = l,
string type,
multicolumn names,
every head row/.style={before row=toprule, after row=midrule},
every last row/.style={after row=bottomrule},
%every other row/.style = {multicolumn{4}{l}{...}}
]{data.csv}

end{document}









share|improve this question
















bumped to the homepage by Community 1 min ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 1





    Welcome to TeX.SX! Please add a minimal working example (MWE), not not just a fragment. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with documentclass and ending with end{document}

    – albert
    Aug 27 '18 at 17:51














0












0








0








I am trying to make a table using pgfplotstable, and am having difficulties because the csv's are jagged. Most rows have 4 columns, as do the headers, but some rows are only 1 column and I would like these 1-cell rows to span the width of the table.



How do I either have pgfplotstable dynamically create multicolumns depending on the csv, or set every other row to be a multicolumn using data from the csv?



mwe (does not produce the proper layout):



documentclass{article}
usepackage{pgfplotstable,multirow,booktabs}

begin{filecontents}{data.csv}
ColumnHeader1, ColumnHeader2, ColumnHeader3, ColumnHeader4
item1, string1, string2, string3
some-text-goes-here
item2, string1, string2, string3
some-more-text-goes-here
end{filecontents}

begin{document}

pgfplotstabletypeset[
col sep = comma,
column type = l,
string type,
multicolumn names,
every head row/.style={before row=toprule, after row=midrule},
every last row/.style={after row=bottomrule},
%every other row/.style = {multicolumn{4}{l}{...}}
]{data.csv}

end{document}









share|improve this question
















I am trying to make a table using pgfplotstable, and am having difficulties because the csv's are jagged. Most rows have 4 columns, as do the headers, but some rows are only 1 column and I would like these 1-cell rows to span the width of the table.



How do I either have pgfplotstable dynamically create multicolumns depending on the csv, or set every other row to be a multicolumn using data from the csv?



mwe (does not produce the proper layout):



documentclass{article}
usepackage{pgfplotstable,multirow,booktabs}

begin{filecontents}{data.csv}
ColumnHeader1, ColumnHeader2, ColumnHeader3, ColumnHeader4
item1, string1, string2, string3
some-text-goes-here
item2, string1, string2, string3
some-more-text-goes-here
end{filecontents}

begin{document}

pgfplotstabletypeset[
col sep = comma,
column type = l,
string type,
multicolumn names,
every head row/.style={before row=toprule, after row=midrule},
every last row/.style={after row=bottomrule},
%every other row/.style = {multicolumn{4}{l}{...}}
]{data.csv}

end{document}






pgfplotstable multicolumn






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 27 '18 at 20:04







KeBr

















asked Aug 27 '18 at 17:33









KeBrKeBr

12




12





bumped to the homepage by Community 1 min ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 1 min ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.










  • 1





    Welcome to TeX.SX! Please add a minimal working example (MWE), not not just a fragment. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with documentclass and ending with end{document}

    – albert
    Aug 27 '18 at 17:51














  • 1





    Welcome to TeX.SX! Please add a minimal working example (MWE), not not just a fragment. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with documentclass and ending with end{document}

    – albert
    Aug 27 '18 at 17:51








1




1





Welcome to TeX.SX! Please add a minimal working example (MWE), not not just a fragment. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with documentclass and ending with end{document}

– albert
Aug 27 '18 at 17:51





Welcome to TeX.SX! Please add a minimal working example (MWE), not not just a fragment. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with documentclass and ending with end{document}

– albert
Aug 27 '18 at 17:51










1 Answer
1






active

oldest

votes


















0














If you want to have multicolumns by default, with the exception of the head row and possibly other exceptions, you can hack "typeset cell" from the columns.



The default is:



ifnumpgfplotstablecol=pgfplotstablecols%
pgfkeyssetvalue{/pgfplots/table/@cell content}{#1\}%
else%
pgfkeyssetvalue{/pgfplots/table/@cell content}{#1 &}%
fi%


And you make it out of it:



pgfplotstableset{
typeset cell/.code={%%
ifnumpgfplotstablerow=-1% Head Row (Exception)
ifnumpgfplotstablecol=pgfplotstablecols%
pgfkeyssetvalue{/pgfplots/table/@cell content}{#1\}%
else%
pgfkeyssetvalue{/pgfplots/table/@cell content}{#1 &}%
fi%
else
ifnumpgfplotstablerow=2% Another Exception Row ...
ifnumpgfplotstablecol=pgfplotstablecols%
pgfkeyssetvalue{/pgfplots/table/@cell content}{#1\}%
else%
pgfkeyssetvalue{/pgfplots/table/@cell content}{#1 &}%
fi%
else%
ifnumpgfplotstablecol=pgfplotstablecols% Standard
pgfkeyssetvalue{/pgfplots/table/@cell content}{\}%
else%
ifnumpgfplotstablecol=1%
pgfkeyssetvalue{/pgfplots/table/@cell content}{multicolumn{4}{c}{#1}}%
else%
pgfkeyssetvalue{/pgfplots/table/@cell content}{}%
fifififi%
},%%
}


enter image description here



MWE:



documentclass[margin=5pt,]{standalone}
%documentclass{article}
usepackage{pgfplotstable,booktabs, filecontents}
pgfplotsset{compat=1.12}

begin{filecontents*}{jobname-data.csv}
A,B,C,D
Some Text goes here in a multicolum., , ,
string1 (bad), string2, string3, string4
string1 (good), string2, string3, string4
Some more Text goes here in a multicolum., , ,
Some Text goes here in a multicolum., , ,
end{filecontents*}

pgfplotstableset{
typeset cell/.code={%%
ifnumpgfplotstablerow=-1% Head Row (Exception)
ifnumpgfplotstablecol=pgfplotstablecols%
pgfkeyssetvalue{/pgfplots/table/@cell content}{#1\}%
else%
pgfkeyssetvalue{/pgfplots/table/@cell content}{#1 &}%
fi%
else
ifnumpgfplotstablerow=2% Another Exception Row ...
ifnumpgfplotstablecol=pgfplotstablecols%
pgfkeyssetvalue{/pgfplots/table/@cell content}{#1\}%
else%
pgfkeyssetvalue{/pgfplots/table/@cell content}{#1 &}%
fi%
else%
ifnumpgfplotstablecol=pgfplotstablecols% Standard
pgfkeyssetvalue{/pgfplots/table/@cell content}{\}%
else%
ifnumpgfplotstablecol=1%
pgfkeyssetvalue{/pgfplots/table/@cell content}{multicolumn{4}{c}{#1}}%
else%
pgfkeyssetvalue{/pgfplots/table/@cell content}{}%
fifififi%
},%%
}

begin{document}
pgfplotstabletypeset[col sep = comma,
string type,
column type = l,
multicolumn names,
every head row/.style={before row=toprule, after row=midrule},
every last row/.style={after row=bottomrule},
]{jobname-data.csv}
end{document}





share|improve this answer
























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "85"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f448037%2fpgfplotstable-have-every-other-row-be-a-multicolumn%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    If you want to have multicolumns by default, with the exception of the head row and possibly other exceptions, you can hack "typeset cell" from the columns.



    The default is:



    ifnumpgfplotstablecol=pgfplotstablecols%
    pgfkeyssetvalue{/pgfplots/table/@cell content}{#1\}%
    else%
    pgfkeyssetvalue{/pgfplots/table/@cell content}{#1 &}%
    fi%


    And you make it out of it:



    pgfplotstableset{
    typeset cell/.code={%%
    ifnumpgfplotstablerow=-1% Head Row (Exception)
    ifnumpgfplotstablecol=pgfplotstablecols%
    pgfkeyssetvalue{/pgfplots/table/@cell content}{#1\}%
    else%
    pgfkeyssetvalue{/pgfplots/table/@cell content}{#1 &}%
    fi%
    else
    ifnumpgfplotstablerow=2% Another Exception Row ...
    ifnumpgfplotstablecol=pgfplotstablecols%
    pgfkeyssetvalue{/pgfplots/table/@cell content}{#1\}%
    else%
    pgfkeyssetvalue{/pgfplots/table/@cell content}{#1 &}%
    fi%
    else%
    ifnumpgfplotstablecol=pgfplotstablecols% Standard
    pgfkeyssetvalue{/pgfplots/table/@cell content}{\}%
    else%
    ifnumpgfplotstablecol=1%
    pgfkeyssetvalue{/pgfplots/table/@cell content}{multicolumn{4}{c}{#1}}%
    else%
    pgfkeyssetvalue{/pgfplots/table/@cell content}{}%
    fifififi%
    },%%
    }


    enter image description here



    MWE:



    documentclass[margin=5pt,]{standalone}
    %documentclass{article}
    usepackage{pgfplotstable,booktabs, filecontents}
    pgfplotsset{compat=1.12}

    begin{filecontents*}{jobname-data.csv}
    A,B,C,D
    Some Text goes here in a multicolum., , ,
    string1 (bad), string2, string3, string4
    string1 (good), string2, string3, string4
    Some more Text goes here in a multicolum., , ,
    Some Text goes here in a multicolum., , ,
    end{filecontents*}

    pgfplotstableset{
    typeset cell/.code={%%
    ifnumpgfplotstablerow=-1% Head Row (Exception)
    ifnumpgfplotstablecol=pgfplotstablecols%
    pgfkeyssetvalue{/pgfplots/table/@cell content}{#1\}%
    else%
    pgfkeyssetvalue{/pgfplots/table/@cell content}{#1 &}%
    fi%
    else
    ifnumpgfplotstablerow=2% Another Exception Row ...
    ifnumpgfplotstablecol=pgfplotstablecols%
    pgfkeyssetvalue{/pgfplots/table/@cell content}{#1\}%
    else%
    pgfkeyssetvalue{/pgfplots/table/@cell content}{#1 &}%
    fi%
    else%
    ifnumpgfplotstablecol=pgfplotstablecols% Standard
    pgfkeyssetvalue{/pgfplots/table/@cell content}{\}%
    else%
    ifnumpgfplotstablecol=1%
    pgfkeyssetvalue{/pgfplots/table/@cell content}{multicolumn{4}{c}{#1}}%
    else%
    pgfkeyssetvalue{/pgfplots/table/@cell content}{}%
    fifififi%
    },%%
    }

    begin{document}
    pgfplotstabletypeset[col sep = comma,
    string type,
    column type = l,
    multicolumn names,
    every head row/.style={before row=toprule, after row=midrule},
    every last row/.style={after row=bottomrule},
    ]{jobname-data.csv}
    end{document}





    share|improve this answer




























      0














      If you want to have multicolumns by default, with the exception of the head row and possibly other exceptions, you can hack "typeset cell" from the columns.



      The default is:



      ifnumpgfplotstablecol=pgfplotstablecols%
      pgfkeyssetvalue{/pgfplots/table/@cell content}{#1\}%
      else%
      pgfkeyssetvalue{/pgfplots/table/@cell content}{#1 &}%
      fi%


      And you make it out of it:



      pgfplotstableset{
      typeset cell/.code={%%
      ifnumpgfplotstablerow=-1% Head Row (Exception)
      ifnumpgfplotstablecol=pgfplotstablecols%
      pgfkeyssetvalue{/pgfplots/table/@cell content}{#1\}%
      else%
      pgfkeyssetvalue{/pgfplots/table/@cell content}{#1 &}%
      fi%
      else
      ifnumpgfplotstablerow=2% Another Exception Row ...
      ifnumpgfplotstablecol=pgfplotstablecols%
      pgfkeyssetvalue{/pgfplots/table/@cell content}{#1\}%
      else%
      pgfkeyssetvalue{/pgfplots/table/@cell content}{#1 &}%
      fi%
      else%
      ifnumpgfplotstablecol=pgfplotstablecols% Standard
      pgfkeyssetvalue{/pgfplots/table/@cell content}{\}%
      else%
      ifnumpgfplotstablecol=1%
      pgfkeyssetvalue{/pgfplots/table/@cell content}{multicolumn{4}{c}{#1}}%
      else%
      pgfkeyssetvalue{/pgfplots/table/@cell content}{}%
      fifififi%
      },%%
      }


      enter image description here



      MWE:



      documentclass[margin=5pt,]{standalone}
      %documentclass{article}
      usepackage{pgfplotstable,booktabs, filecontents}
      pgfplotsset{compat=1.12}

      begin{filecontents*}{jobname-data.csv}
      A,B,C,D
      Some Text goes here in a multicolum., , ,
      string1 (bad), string2, string3, string4
      string1 (good), string2, string3, string4
      Some more Text goes here in a multicolum., , ,
      Some Text goes here in a multicolum., , ,
      end{filecontents*}

      pgfplotstableset{
      typeset cell/.code={%%
      ifnumpgfplotstablerow=-1% Head Row (Exception)
      ifnumpgfplotstablecol=pgfplotstablecols%
      pgfkeyssetvalue{/pgfplots/table/@cell content}{#1\}%
      else%
      pgfkeyssetvalue{/pgfplots/table/@cell content}{#1 &}%
      fi%
      else
      ifnumpgfplotstablerow=2% Another Exception Row ...
      ifnumpgfplotstablecol=pgfplotstablecols%
      pgfkeyssetvalue{/pgfplots/table/@cell content}{#1\}%
      else%
      pgfkeyssetvalue{/pgfplots/table/@cell content}{#1 &}%
      fi%
      else%
      ifnumpgfplotstablecol=pgfplotstablecols% Standard
      pgfkeyssetvalue{/pgfplots/table/@cell content}{\}%
      else%
      ifnumpgfplotstablecol=1%
      pgfkeyssetvalue{/pgfplots/table/@cell content}{multicolumn{4}{c}{#1}}%
      else%
      pgfkeyssetvalue{/pgfplots/table/@cell content}{}%
      fifififi%
      },%%
      }

      begin{document}
      pgfplotstabletypeset[col sep = comma,
      string type,
      column type = l,
      multicolumn names,
      every head row/.style={before row=toprule, after row=midrule},
      every last row/.style={after row=bottomrule},
      ]{jobname-data.csv}
      end{document}





      share|improve this answer


























        0












        0








        0







        If you want to have multicolumns by default, with the exception of the head row and possibly other exceptions, you can hack "typeset cell" from the columns.



        The default is:



        ifnumpgfplotstablecol=pgfplotstablecols%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{#1\}%
        else%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{#1 &}%
        fi%


        And you make it out of it:



        pgfplotstableset{
        typeset cell/.code={%%
        ifnumpgfplotstablerow=-1% Head Row (Exception)
        ifnumpgfplotstablecol=pgfplotstablecols%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{#1\}%
        else%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{#1 &}%
        fi%
        else
        ifnumpgfplotstablerow=2% Another Exception Row ...
        ifnumpgfplotstablecol=pgfplotstablecols%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{#1\}%
        else%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{#1 &}%
        fi%
        else%
        ifnumpgfplotstablecol=pgfplotstablecols% Standard
        pgfkeyssetvalue{/pgfplots/table/@cell content}{\}%
        else%
        ifnumpgfplotstablecol=1%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{multicolumn{4}{c}{#1}}%
        else%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{}%
        fifififi%
        },%%
        }


        enter image description here



        MWE:



        documentclass[margin=5pt,]{standalone}
        %documentclass{article}
        usepackage{pgfplotstable,booktabs, filecontents}
        pgfplotsset{compat=1.12}

        begin{filecontents*}{jobname-data.csv}
        A,B,C,D
        Some Text goes here in a multicolum., , ,
        string1 (bad), string2, string3, string4
        string1 (good), string2, string3, string4
        Some more Text goes here in a multicolum., , ,
        Some Text goes here in a multicolum., , ,
        end{filecontents*}

        pgfplotstableset{
        typeset cell/.code={%%
        ifnumpgfplotstablerow=-1% Head Row (Exception)
        ifnumpgfplotstablecol=pgfplotstablecols%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{#1\}%
        else%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{#1 &}%
        fi%
        else
        ifnumpgfplotstablerow=2% Another Exception Row ...
        ifnumpgfplotstablecol=pgfplotstablecols%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{#1\}%
        else%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{#1 &}%
        fi%
        else%
        ifnumpgfplotstablecol=pgfplotstablecols% Standard
        pgfkeyssetvalue{/pgfplots/table/@cell content}{\}%
        else%
        ifnumpgfplotstablecol=1%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{multicolumn{4}{c}{#1}}%
        else%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{}%
        fifififi%
        },%%
        }

        begin{document}
        pgfplotstabletypeset[col sep = comma,
        string type,
        column type = l,
        multicolumn names,
        every head row/.style={before row=toprule, after row=midrule},
        every last row/.style={after row=bottomrule},
        ]{jobname-data.csv}
        end{document}





        share|improve this answer













        If you want to have multicolumns by default, with the exception of the head row and possibly other exceptions, you can hack "typeset cell" from the columns.



        The default is:



        ifnumpgfplotstablecol=pgfplotstablecols%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{#1\}%
        else%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{#1 &}%
        fi%


        And you make it out of it:



        pgfplotstableset{
        typeset cell/.code={%%
        ifnumpgfplotstablerow=-1% Head Row (Exception)
        ifnumpgfplotstablecol=pgfplotstablecols%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{#1\}%
        else%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{#1 &}%
        fi%
        else
        ifnumpgfplotstablerow=2% Another Exception Row ...
        ifnumpgfplotstablecol=pgfplotstablecols%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{#1\}%
        else%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{#1 &}%
        fi%
        else%
        ifnumpgfplotstablecol=pgfplotstablecols% Standard
        pgfkeyssetvalue{/pgfplots/table/@cell content}{\}%
        else%
        ifnumpgfplotstablecol=1%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{multicolumn{4}{c}{#1}}%
        else%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{}%
        fifififi%
        },%%
        }


        enter image description here



        MWE:



        documentclass[margin=5pt,]{standalone}
        %documentclass{article}
        usepackage{pgfplotstable,booktabs, filecontents}
        pgfplotsset{compat=1.12}

        begin{filecontents*}{jobname-data.csv}
        A,B,C,D
        Some Text goes here in a multicolum., , ,
        string1 (bad), string2, string3, string4
        string1 (good), string2, string3, string4
        Some more Text goes here in a multicolum., , ,
        Some Text goes here in a multicolum., , ,
        end{filecontents*}

        pgfplotstableset{
        typeset cell/.code={%%
        ifnumpgfplotstablerow=-1% Head Row (Exception)
        ifnumpgfplotstablecol=pgfplotstablecols%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{#1\}%
        else%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{#1 &}%
        fi%
        else
        ifnumpgfplotstablerow=2% Another Exception Row ...
        ifnumpgfplotstablecol=pgfplotstablecols%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{#1\}%
        else%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{#1 &}%
        fi%
        else%
        ifnumpgfplotstablecol=pgfplotstablecols% Standard
        pgfkeyssetvalue{/pgfplots/table/@cell content}{\}%
        else%
        ifnumpgfplotstablecol=1%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{multicolumn{4}{c}{#1}}%
        else%
        pgfkeyssetvalue{/pgfplots/table/@cell content}{}%
        fifififi%
        },%%
        }

        begin{document}
        pgfplotstabletypeset[col sep = comma,
        string type,
        column type = l,
        multicolumn names,
        every head row/.style={before row=toprule, after row=midrule},
        every last row/.style={after row=bottomrule},
        ]{jobname-data.csv}
        end{document}






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 13 '18 at 20:56









        ciscis

        747516




        747516






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f448037%2fpgfplotstable-have-every-other-row-be-a-multicolumn%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Why does my Macbook overheat and use so much CPU and energy when on YouTube?Why do so many insist on using...

            How to prevent page numbers from appearing on glossaries?How to remove a dot and a page number in the...

            Puerta de Hutt Referencias Enlaces externos Menú de navegación15°58′00″S 5°42′00″O /...