pgfplotstable - how to get numbers in a column to be formatted with colons and align at colonsLong table and...

Survey Confirmation - Emphasize the question or the answer?

LT Spice Voltage Output

How did Arya manage to disguise herself?

You look catfish vs You look like a catfish?

How did Arya get back her dagger from Sansa?

Transfer over $10k

Why debootstrap can only run as root?

Does hiding behind 5-ft-wide cover give full cover?

Why is Thanos so tough at the beginning of "Avengers: Endgame"?

Was the ancestor of SCSI, the SASI protocol, nothing more than a draft?

I’ve officially counted to infinity!

Pigeonhole Principle Problem

What is the word which sounds like "shtrass"?

What does air vanishing on contact sound like?

How to creep the reader out with what seems like a normal person?

Disabling Resource Governor in SQL Server

Why do freehub and cassette have only one position that matches?

When and why did journal article titles become descriptive, rather than creatively allusive?

Map one pandas column using two dictionaries

Can I use 1000v rectifier diodes instead of 600v rectifier diodes?

Short story about people living in a different time streams

I caught several of my students plagiarizing. Could it be my fault as a teacher?

If Earth is tilted, why is Polaris always above the same spot?

How do you center multiple equations that have multiple steps?



pgfplotstable - how to get numbers in a column to be formatted with colons and align at colons


Long table and pgfplotstable with multiple data filesReplace Column in PGFPlotstable with lookup valuesMultiple Multi columns with pgfplotstablePGFPLOTSTABLE configuration, bold style for headers, specific row, and specific formatting from CSVlongtable with pgfplotstable - adding predefined rows and breaking manuallyHow to get a “thousands” separator in `spreadtab` (wrapping `longtable`)?create header row and index column pgfplotstableColumn width and row height with pgfplotstablepgfplotstable: How to get header-elements?pgfplotstable: How to get 'column name' with 'pgfkeysgetvalue'













1















I currently have a pgfplotstable longtable where the first two of the columns has values given in degrees (e.g. 5.678) but I want to display them in terms of hours:mins:secs. The conversion isn't my problem; my text file will have the right numbers. My question is how best to make the table (or format the txt file so that making the table will be easier) so that I can have the colons in the content of the cells and align based on the first colon. Some ideas I had were:



1) Use dec sep={:} and actually format my txt file with periods (hours.mins.sec) but this fails (I assume because I have multiple decimals in the number as opposed to just one) and also the last decimal needs to be a real decimal and not a placeholder for a colon, so I don't see this working.



2) Format my txt file so the value is split into an hours columns, a mins one, and a secs one, and then use a multicolumn{3}{alignment} and then maybe add a postproc cell content to add the colons, but I am a beginner so I don't think I know how to do that properly. Also, the spacing between columns wouldn't look right.



Does anyone have any other ideas? I could use some major help here! Thanks!



My MWE (for my current table - none of the things I tried would be considered a "working" example):



documentclass{article}
usepackage{booktabs} % For toprule, midrule and bottomrule
usepackage{siunitx} % Formats the units and values
usepackage{pgfplotstable} % Generates table from .csv
usepackage{longtable} % To display tables on several pages
usepackage{array}
usepackage{bm}
usepackage{hyperref}

% Setup siunitx:
sisetup{
% Rounds numbers
round-mode = places,
% to 4 places
round-precision = 3,
}

pgfplotsset{compat=1.14} %was giving me backwards compatibility errors

begin{document}

%%% Code from Dr. Christian for not using headers
pgfkeysifdefined{/pgfplots/table/output empty row/.@cmd}{
pgfplotstableset{
empty header/.style={
every head row/.style={output empty row},
}
}
}

pgfplotstableset{
begin table=begin{longtable},
end table=end{longtable},
}

pgfplotstabletypeset[
empty header,
col sep=space,
every head row/.append style={
before row={%
caption{The caption}
label{tab:DataTable}
\ toprule
% the dec sep align options makes two tabular columns, so we need multicolumn for the header
multicolumn{2}{c}{textbf{RA}} & multicolumn{2}{c}{textbf{Dec}} & multicolumn{2}{c}{textbf{S}} \
multicolumn{2}{c}{bfseries hh:mm:ss} & multicolumn{2}{c}{bfseries deg:min:sec} & multicolumn{2}{c}{textbf{mJy}}
\ midrule
endfirsthead
%
% split this over two lines, so that it doesn't make the table too wide
multicolumn{6}{l}{{bfseries tablename thetable{} -- continued from}} \
multicolumn{6}{l}{{bfseries previous page}}
\ toprule
multicolumn{2}{c}{textbf{RA}} & multicolumn{2}{c}{textbf{Dec}} & multicolumn{2}{c}{textbf{S}}
\ midrule
endhead
%
midrule
multicolumn{6}{c}
{{Continued on next page}}
\ bottomrule
endfoot
%
midrule
multicolumn{6}{r}{}
\ bottomrule
endlastfoot
}
},
display columns/0/.style={
dec sep align,
fixed, fixed zerofill,
precision=2
},
display columns/1/.style={
dec sep align,
fixed, fixed zerofill,
precision=2
},
display columns/2/.style={
dec sep align,
fixed, fixed zerofill,
precision=2
}
]{data.txt}

end{document}


Sample file for my current table:



1.00 2.00 3.456
4.00 5.00 4.567
7.00 8.00 5.678


Sample file for suggestion #1 above (all decimals except the last decimal in each value would need to be changed to colons):



01.00.0.00 02.00.0.00 3.456
04.00.0.00 05.00.0.00 4.567
07.00.0.00 08.00.0.00 5.678


Sample file for suggestion #2 above:



01 00 0.00 02 00 0.00 3.456
04 00 0.00 05 00 0.00 4.567
07 00 0.00 08 00 0.00 5.678


Remember, I only want to change the first two columns.



All thoughts are welcome. Thanks again!










share|improve this question














bumped to the homepage by Community 2 hours ago


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




















    1















    I currently have a pgfplotstable longtable where the first two of the columns has values given in degrees (e.g. 5.678) but I want to display them in terms of hours:mins:secs. The conversion isn't my problem; my text file will have the right numbers. My question is how best to make the table (or format the txt file so that making the table will be easier) so that I can have the colons in the content of the cells and align based on the first colon. Some ideas I had were:



    1) Use dec sep={:} and actually format my txt file with periods (hours.mins.sec) but this fails (I assume because I have multiple decimals in the number as opposed to just one) and also the last decimal needs to be a real decimal and not a placeholder for a colon, so I don't see this working.



    2) Format my txt file so the value is split into an hours columns, a mins one, and a secs one, and then use a multicolumn{3}{alignment} and then maybe add a postproc cell content to add the colons, but I am a beginner so I don't think I know how to do that properly. Also, the spacing between columns wouldn't look right.



    Does anyone have any other ideas? I could use some major help here! Thanks!



    My MWE (for my current table - none of the things I tried would be considered a "working" example):



    documentclass{article}
    usepackage{booktabs} % For toprule, midrule and bottomrule
    usepackage{siunitx} % Formats the units and values
    usepackage{pgfplotstable} % Generates table from .csv
    usepackage{longtable} % To display tables on several pages
    usepackage{array}
    usepackage{bm}
    usepackage{hyperref}

    % Setup siunitx:
    sisetup{
    % Rounds numbers
    round-mode = places,
    % to 4 places
    round-precision = 3,
    }

    pgfplotsset{compat=1.14} %was giving me backwards compatibility errors

    begin{document}

    %%% Code from Dr. Christian for not using headers
    pgfkeysifdefined{/pgfplots/table/output empty row/.@cmd}{
    pgfplotstableset{
    empty header/.style={
    every head row/.style={output empty row},
    }
    }
    }

    pgfplotstableset{
    begin table=begin{longtable},
    end table=end{longtable},
    }

    pgfplotstabletypeset[
    empty header,
    col sep=space,
    every head row/.append style={
    before row={%
    caption{The caption}
    label{tab:DataTable}
    \ toprule
    % the dec sep align options makes two tabular columns, so we need multicolumn for the header
    multicolumn{2}{c}{textbf{RA}} & multicolumn{2}{c}{textbf{Dec}} & multicolumn{2}{c}{textbf{S}} \
    multicolumn{2}{c}{bfseries hh:mm:ss} & multicolumn{2}{c}{bfseries deg:min:sec} & multicolumn{2}{c}{textbf{mJy}}
    \ midrule
    endfirsthead
    %
    % split this over two lines, so that it doesn't make the table too wide
    multicolumn{6}{l}{{bfseries tablename thetable{} -- continued from}} \
    multicolumn{6}{l}{{bfseries previous page}}
    \ toprule
    multicolumn{2}{c}{textbf{RA}} & multicolumn{2}{c}{textbf{Dec}} & multicolumn{2}{c}{textbf{S}}
    \ midrule
    endhead
    %
    midrule
    multicolumn{6}{c}
    {{Continued on next page}}
    \ bottomrule
    endfoot
    %
    midrule
    multicolumn{6}{r}{}
    \ bottomrule
    endlastfoot
    }
    },
    display columns/0/.style={
    dec sep align,
    fixed, fixed zerofill,
    precision=2
    },
    display columns/1/.style={
    dec sep align,
    fixed, fixed zerofill,
    precision=2
    },
    display columns/2/.style={
    dec sep align,
    fixed, fixed zerofill,
    precision=2
    }
    ]{data.txt}

    end{document}


    Sample file for my current table:



    1.00 2.00 3.456
    4.00 5.00 4.567
    7.00 8.00 5.678


    Sample file for suggestion #1 above (all decimals except the last decimal in each value would need to be changed to colons):



    01.00.0.00 02.00.0.00 3.456
    04.00.0.00 05.00.0.00 4.567
    07.00.0.00 08.00.0.00 5.678


    Sample file for suggestion #2 above:



    01 00 0.00 02 00 0.00 3.456
    04 00 0.00 05 00 0.00 4.567
    07 00 0.00 08 00 0.00 5.678


    Remember, I only want to change the first two columns.



    All thoughts are welcome. Thanks again!










    share|improve this question














    bumped to the homepage by Community 2 hours ago


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


















      1












      1








      1


      0






      I currently have a pgfplotstable longtable where the first two of the columns has values given in degrees (e.g. 5.678) but I want to display them in terms of hours:mins:secs. The conversion isn't my problem; my text file will have the right numbers. My question is how best to make the table (or format the txt file so that making the table will be easier) so that I can have the colons in the content of the cells and align based on the first colon. Some ideas I had were:



      1) Use dec sep={:} and actually format my txt file with periods (hours.mins.sec) but this fails (I assume because I have multiple decimals in the number as opposed to just one) and also the last decimal needs to be a real decimal and not a placeholder for a colon, so I don't see this working.



      2) Format my txt file so the value is split into an hours columns, a mins one, and a secs one, and then use a multicolumn{3}{alignment} and then maybe add a postproc cell content to add the colons, but I am a beginner so I don't think I know how to do that properly. Also, the spacing between columns wouldn't look right.



      Does anyone have any other ideas? I could use some major help here! Thanks!



      My MWE (for my current table - none of the things I tried would be considered a "working" example):



      documentclass{article}
      usepackage{booktabs} % For toprule, midrule and bottomrule
      usepackage{siunitx} % Formats the units and values
      usepackage{pgfplotstable} % Generates table from .csv
      usepackage{longtable} % To display tables on several pages
      usepackage{array}
      usepackage{bm}
      usepackage{hyperref}

      % Setup siunitx:
      sisetup{
      % Rounds numbers
      round-mode = places,
      % to 4 places
      round-precision = 3,
      }

      pgfplotsset{compat=1.14} %was giving me backwards compatibility errors

      begin{document}

      %%% Code from Dr. Christian for not using headers
      pgfkeysifdefined{/pgfplots/table/output empty row/.@cmd}{
      pgfplotstableset{
      empty header/.style={
      every head row/.style={output empty row},
      }
      }
      }

      pgfplotstableset{
      begin table=begin{longtable},
      end table=end{longtable},
      }

      pgfplotstabletypeset[
      empty header,
      col sep=space,
      every head row/.append style={
      before row={%
      caption{The caption}
      label{tab:DataTable}
      \ toprule
      % the dec sep align options makes two tabular columns, so we need multicolumn for the header
      multicolumn{2}{c}{textbf{RA}} & multicolumn{2}{c}{textbf{Dec}} & multicolumn{2}{c}{textbf{S}} \
      multicolumn{2}{c}{bfseries hh:mm:ss} & multicolumn{2}{c}{bfseries deg:min:sec} & multicolumn{2}{c}{textbf{mJy}}
      \ midrule
      endfirsthead
      %
      % split this over two lines, so that it doesn't make the table too wide
      multicolumn{6}{l}{{bfseries tablename thetable{} -- continued from}} \
      multicolumn{6}{l}{{bfseries previous page}}
      \ toprule
      multicolumn{2}{c}{textbf{RA}} & multicolumn{2}{c}{textbf{Dec}} & multicolumn{2}{c}{textbf{S}}
      \ midrule
      endhead
      %
      midrule
      multicolumn{6}{c}
      {{Continued on next page}}
      \ bottomrule
      endfoot
      %
      midrule
      multicolumn{6}{r}{}
      \ bottomrule
      endlastfoot
      }
      },
      display columns/0/.style={
      dec sep align,
      fixed, fixed zerofill,
      precision=2
      },
      display columns/1/.style={
      dec sep align,
      fixed, fixed zerofill,
      precision=2
      },
      display columns/2/.style={
      dec sep align,
      fixed, fixed zerofill,
      precision=2
      }
      ]{data.txt}

      end{document}


      Sample file for my current table:



      1.00 2.00 3.456
      4.00 5.00 4.567
      7.00 8.00 5.678


      Sample file for suggestion #1 above (all decimals except the last decimal in each value would need to be changed to colons):



      01.00.0.00 02.00.0.00 3.456
      04.00.0.00 05.00.0.00 4.567
      07.00.0.00 08.00.0.00 5.678


      Sample file for suggestion #2 above:



      01 00 0.00 02 00 0.00 3.456
      04 00 0.00 05 00 0.00 4.567
      07 00 0.00 08 00 0.00 5.678


      Remember, I only want to change the first two columns.



      All thoughts are welcome. Thanks again!










      share|improve this question














      I currently have a pgfplotstable longtable where the first two of the columns has values given in degrees (e.g. 5.678) but I want to display them in terms of hours:mins:secs. The conversion isn't my problem; my text file will have the right numbers. My question is how best to make the table (or format the txt file so that making the table will be easier) so that I can have the colons in the content of the cells and align based on the first colon. Some ideas I had were:



      1) Use dec sep={:} and actually format my txt file with periods (hours.mins.sec) but this fails (I assume because I have multiple decimals in the number as opposed to just one) and also the last decimal needs to be a real decimal and not a placeholder for a colon, so I don't see this working.



      2) Format my txt file so the value is split into an hours columns, a mins one, and a secs one, and then use a multicolumn{3}{alignment} and then maybe add a postproc cell content to add the colons, but I am a beginner so I don't think I know how to do that properly. Also, the spacing between columns wouldn't look right.



      Does anyone have any other ideas? I could use some major help here! Thanks!



      My MWE (for my current table - none of the things I tried would be considered a "working" example):



      documentclass{article}
      usepackage{booktabs} % For toprule, midrule and bottomrule
      usepackage{siunitx} % Formats the units and values
      usepackage{pgfplotstable} % Generates table from .csv
      usepackage{longtable} % To display tables on several pages
      usepackage{array}
      usepackage{bm}
      usepackage{hyperref}

      % Setup siunitx:
      sisetup{
      % Rounds numbers
      round-mode = places,
      % to 4 places
      round-precision = 3,
      }

      pgfplotsset{compat=1.14} %was giving me backwards compatibility errors

      begin{document}

      %%% Code from Dr. Christian for not using headers
      pgfkeysifdefined{/pgfplots/table/output empty row/.@cmd}{
      pgfplotstableset{
      empty header/.style={
      every head row/.style={output empty row},
      }
      }
      }

      pgfplotstableset{
      begin table=begin{longtable},
      end table=end{longtable},
      }

      pgfplotstabletypeset[
      empty header,
      col sep=space,
      every head row/.append style={
      before row={%
      caption{The caption}
      label{tab:DataTable}
      \ toprule
      % the dec sep align options makes two tabular columns, so we need multicolumn for the header
      multicolumn{2}{c}{textbf{RA}} & multicolumn{2}{c}{textbf{Dec}} & multicolumn{2}{c}{textbf{S}} \
      multicolumn{2}{c}{bfseries hh:mm:ss} & multicolumn{2}{c}{bfseries deg:min:sec} & multicolumn{2}{c}{textbf{mJy}}
      \ midrule
      endfirsthead
      %
      % split this over two lines, so that it doesn't make the table too wide
      multicolumn{6}{l}{{bfseries tablename thetable{} -- continued from}} \
      multicolumn{6}{l}{{bfseries previous page}}
      \ toprule
      multicolumn{2}{c}{textbf{RA}} & multicolumn{2}{c}{textbf{Dec}} & multicolumn{2}{c}{textbf{S}}
      \ midrule
      endhead
      %
      midrule
      multicolumn{6}{c}
      {{Continued on next page}}
      \ bottomrule
      endfoot
      %
      midrule
      multicolumn{6}{r}{}
      \ bottomrule
      endlastfoot
      }
      },
      display columns/0/.style={
      dec sep align,
      fixed, fixed zerofill,
      precision=2
      },
      display columns/1/.style={
      dec sep align,
      fixed, fixed zerofill,
      precision=2
      },
      display columns/2/.style={
      dec sep align,
      fixed, fixed zerofill,
      precision=2
      }
      ]{data.txt}

      end{document}


      Sample file for my current table:



      1.00 2.00 3.456
      4.00 5.00 4.567
      7.00 8.00 5.678


      Sample file for suggestion #1 above (all decimals except the last decimal in each value would need to be changed to colons):



      01.00.0.00 02.00.0.00 3.456
      04.00.0.00 05.00.0.00 4.567
      07.00.0.00 08.00.0.00 5.678


      Sample file for suggestion #2 above:



      01 00 0.00 02 00 0.00 3.456
      04 00 0.00 05 00 0.00 4.567
      07 00 0.00 08 00 0.00 5.678


      Remember, I only want to change the first two columns.



      All thoughts are welcome. Thanks again!







      formatting longtable pgfplotstable






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jun 29 '18 at 14:28









      Oriel FarajunOriel Farajun

      234




      234





      bumped to the homepage by Community 2 hours 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 2 hours ago


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
























          1 Answer
          1






          active

          oldest

          votes


















          0














          I'd opt for suggestion #2, with @{:} as a separator when needed.



          I also add some phantoms to adjust alignment.



          documentclass[a5paper]{article}
          usepackage{array}
          usepackage{pgfplotstable}
          pgfplotsset{compat=1.15}
          usepackage{booktabs}
          usepackage{longtable}
          usepackage{siunitx}

          usepackage{filecontents}
          begin{filecontents}{data.txt}
          01 00 0.00 02 00 0.00 3.456
          04 00 0.00 05 00 0.00 4.567
          07 00 0.00 08 00 0.00 5.678
          01 00 0.00 02 00 0.00 3.456
          04 00 0.00 05 00 0.00 4.567
          07 00 0.00 08 00 0.00 5.678
          01 00 0.00 02 00 0.00 3.456
          04 00 0.00 05 00 0.00 4.567
          07 00 0.00 08 00 0.00 5.678
          01 00 0.00 02 00 0.00 3.456
          04 00 0.00 05 00 0.00 4.567
          07 00 0.00 08 00 0.00 5.678
          01 00 0.00 02 00 0.00 3.456
          04 00 0.00 05 00 0.00 4.567
          07 00 0.00 08 00 0.00 5.678
          01 00 0.00 02 00 0.00 3.456
          04 00 0.00 05 00 0.00 4.567
          07 00 0.00 08 00 0.00 5.678
          01 00 0.00 02 00 0.00 3.456
          04 00 0.00 05 00 0.00 4.567
          07 00 0.00 08 00 0.00 5.678
          01 00 0.00 02 00 0.00 3.456
          04 00 0.00 05 00 0.00 4.567
          07 00 0.00 08 00 0.00 5.678
          01 00 0.00 02 00 0.00 3.456
          04 00 0.00 05 00 0.00 4.567
          07 00 0.00 08 00 0.00 5.678
          01 00 0.00 02 00 0.00 3.456
          04 00 0.00 05 00 0.00 4.567
          07 00 0.00 08 00 0.00 5.678
          01 00 0.00 02 00 0.00 3.456
          04 00 0.00 05 00 0.00 4.567
          07 00 0.00 08 00 0.00 5.678
          01 00 0.00 02 00 0.00 3.456
          04 00 0.00 05 00 0.00 4.567
          07 00 0.00 08 00 0.00 5.678
          01 00 0.00 02 00 0.00 3.456
          04 00 0.00 05 00 0.00 4.567
          07 00 0.00 08 00 0.00 5.678
          01 00 0.00 02 00 0.00 3.456
          04 00 0.00 05 00 0.00 4.567
          07 00 0.00 08 00 0.00 5.678
          end{filecontents}

          begin{document}

          pgfplotstableset{
          begin table=begin{longtable},
          end table=end{longtable},
          }

          pgfplotstableset{
          every head row/.style={output empty row},
          every head row/.append style={before row={%
          caption{The caption}
          label{tab:DataTable}\
          toprule
          multicolumn{3}{c}{textbf{RA}} & multicolumn{3}{c}{textbf{Dec}} & multicolumn{1}{c}{textbf{S}} \
          multicolumn{3}{c}{bfseries hh:mm:ss} & multicolumn{3}{c}{bfseries deg:min:sec} & multicolumn{1}{c}{textbf{mJy}}
          \
          midrule
          endfirsthead
          multicolumn{7}{c}{tablename thetable{} -- continued from}\
          multicolumn{7}{c}{previous page}\[1ex]
          toprule
          multicolumn{3}{c}{textbf{RA}} & multicolumn{3}{c}{textbf{Dec}} & multicolumn{1}{c}{textbf{S}} \
          multicolumn{3}{c}{bfseries hh:mm:ss} & multicolumn{3}{c}{bfseries deg:min:sec} & multicolumn{1}{c}{textbf{mJy}}
          \
          midrule
          endhead
          midrule
          multicolumn{7}{r}{Continued on next page}\
          endfoot
          bottomrule
          endlastfoot
          },
          },
          }

          pgfplotstabletypeset[col sep=space,
          columns/0/.style={string type,column type=r,column type/.add={>{phantom{.}}}{@{:}}},
          columns/1/.style={string type,column type=c,column type/.add={}{@{:}}},
          columns/2/.style={string type,column type=l},
          columns/3/.style={string type,column type=r,column type/.add={>{phantom{0.}}}{@{:}}},
          columns/4/.style={string type,column type=c,column type/.add={}{@{:}}},
          columns/5/.style={string type,column type=l},
          columns/6/.style={string type,column type={S[table-format=1.2, round-mode=places,
          round-precision=2]}}
          ]{data.txt}

          end{document}


          First page:



          enter image description here



          Second page:



          enter image description here






          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%2f438555%2fpgfplotstable-how-to-get-numbers-in-a-column-to-be-formatted-with-colons-and-a%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














            I'd opt for suggestion #2, with @{:} as a separator when needed.



            I also add some phantoms to adjust alignment.



            documentclass[a5paper]{article}
            usepackage{array}
            usepackage{pgfplotstable}
            pgfplotsset{compat=1.15}
            usepackage{booktabs}
            usepackage{longtable}
            usepackage{siunitx}

            usepackage{filecontents}
            begin{filecontents}{data.txt}
            01 00 0.00 02 00 0.00 3.456
            04 00 0.00 05 00 0.00 4.567
            07 00 0.00 08 00 0.00 5.678
            01 00 0.00 02 00 0.00 3.456
            04 00 0.00 05 00 0.00 4.567
            07 00 0.00 08 00 0.00 5.678
            01 00 0.00 02 00 0.00 3.456
            04 00 0.00 05 00 0.00 4.567
            07 00 0.00 08 00 0.00 5.678
            01 00 0.00 02 00 0.00 3.456
            04 00 0.00 05 00 0.00 4.567
            07 00 0.00 08 00 0.00 5.678
            01 00 0.00 02 00 0.00 3.456
            04 00 0.00 05 00 0.00 4.567
            07 00 0.00 08 00 0.00 5.678
            01 00 0.00 02 00 0.00 3.456
            04 00 0.00 05 00 0.00 4.567
            07 00 0.00 08 00 0.00 5.678
            01 00 0.00 02 00 0.00 3.456
            04 00 0.00 05 00 0.00 4.567
            07 00 0.00 08 00 0.00 5.678
            01 00 0.00 02 00 0.00 3.456
            04 00 0.00 05 00 0.00 4.567
            07 00 0.00 08 00 0.00 5.678
            01 00 0.00 02 00 0.00 3.456
            04 00 0.00 05 00 0.00 4.567
            07 00 0.00 08 00 0.00 5.678
            01 00 0.00 02 00 0.00 3.456
            04 00 0.00 05 00 0.00 4.567
            07 00 0.00 08 00 0.00 5.678
            01 00 0.00 02 00 0.00 3.456
            04 00 0.00 05 00 0.00 4.567
            07 00 0.00 08 00 0.00 5.678
            01 00 0.00 02 00 0.00 3.456
            04 00 0.00 05 00 0.00 4.567
            07 00 0.00 08 00 0.00 5.678
            01 00 0.00 02 00 0.00 3.456
            04 00 0.00 05 00 0.00 4.567
            07 00 0.00 08 00 0.00 5.678
            01 00 0.00 02 00 0.00 3.456
            04 00 0.00 05 00 0.00 4.567
            07 00 0.00 08 00 0.00 5.678
            end{filecontents}

            begin{document}

            pgfplotstableset{
            begin table=begin{longtable},
            end table=end{longtable},
            }

            pgfplotstableset{
            every head row/.style={output empty row},
            every head row/.append style={before row={%
            caption{The caption}
            label{tab:DataTable}\
            toprule
            multicolumn{3}{c}{textbf{RA}} & multicolumn{3}{c}{textbf{Dec}} & multicolumn{1}{c}{textbf{S}} \
            multicolumn{3}{c}{bfseries hh:mm:ss} & multicolumn{3}{c}{bfseries deg:min:sec} & multicolumn{1}{c}{textbf{mJy}}
            \
            midrule
            endfirsthead
            multicolumn{7}{c}{tablename thetable{} -- continued from}\
            multicolumn{7}{c}{previous page}\[1ex]
            toprule
            multicolumn{3}{c}{textbf{RA}} & multicolumn{3}{c}{textbf{Dec}} & multicolumn{1}{c}{textbf{S}} \
            multicolumn{3}{c}{bfseries hh:mm:ss} & multicolumn{3}{c}{bfseries deg:min:sec} & multicolumn{1}{c}{textbf{mJy}}
            \
            midrule
            endhead
            midrule
            multicolumn{7}{r}{Continued on next page}\
            endfoot
            bottomrule
            endlastfoot
            },
            },
            }

            pgfplotstabletypeset[col sep=space,
            columns/0/.style={string type,column type=r,column type/.add={>{phantom{.}}}{@{:}}},
            columns/1/.style={string type,column type=c,column type/.add={}{@{:}}},
            columns/2/.style={string type,column type=l},
            columns/3/.style={string type,column type=r,column type/.add={>{phantom{0.}}}{@{:}}},
            columns/4/.style={string type,column type=c,column type/.add={}{@{:}}},
            columns/5/.style={string type,column type=l},
            columns/6/.style={string type,column type={S[table-format=1.2, round-mode=places,
            round-precision=2]}}
            ]{data.txt}

            end{document}


            First page:



            enter image description here



            Second page:



            enter image description here






            share|improve this answer




























              0














              I'd opt for suggestion #2, with @{:} as a separator when needed.



              I also add some phantoms to adjust alignment.



              documentclass[a5paper]{article}
              usepackage{array}
              usepackage{pgfplotstable}
              pgfplotsset{compat=1.15}
              usepackage{booktabs}
              usepackage{longtable}
              usepackage{siunitx}

              usepackage{filecontents}
              begin{filecontents}{data.txt}
              01 00 0.00 02 00 0.00 3.456
              04 00 0.00 05 00 0.00 4.567
              07 00 0.00 08 00 0.00 5.678
              01 00 0.00 02 00 0.00 3.456
              04 00 0.00 05 00 0.00 4.567
              07 00 0.00 08 00 0.00 5.678
              01 00 0.00 02 00 0.00 3.456
              04 00 0.00 05 00 0.00 4.567
              07 00 0.00 08 00 0.00 5.678
              01 00 0.00 02 00 0.00 3.456
              04 00 0.00 05 00 0.00 4.567
              07 00 0.00 08 00 0.00 5.678
              01 00 0.00 02 00 0.00 3.456
              04 00 0.00 05 00 0.00 4.567
              07 00 0.00 08 00 0.00 5.678
              01 00 0.00 02 00 0.00 3.456
              04 00 0.00 05 00 0.00 4.567
              07 00 0.00 08 00 0.00 5.678
              01 00 0.00 02 00 0.00 3.456
              04 00 0.00 05 00 0.00 4.567
              07 00 0.00 08 00 0.00 5.678
              01 00 0.00 02 00 0.00 3.456
              04 00 0.00 05 00 0.00 4.567
              07 00 0.00 08 00 0.00 5.678
              01 00 0.00 02 00 0.00 3.456
              04 00 0.00 05 00 0.00 4.567
              07 00 0.00 08 00 0.00 5.678
              01 00 0.00 02 00 0.00 3.456
              04 00 0.00 05 00 0.00 4.567
              07 00 0.00 08 00 0.00 5.678
              01 00 0.00 02 00 0.00 3.456
              04 00 0.00 05 00 0.00 4.567
              07 00 0.00 08 00 0.00 5.678
              01 00 0.00 02 00 0.00 3.456
              04 00 0.00 05 00 0.00 4.567
              07 00 0.00 08 00 0.00 5.678
              01 00 0.00 02 00 0.00 3.456
              04 00 0.00 05 00 0.00 4.567
              07 00 0.00 08 00 0.00 5.678
              01 00 0.00 02 00 0.00 3.456
              04 00 0.00 05 00 0.00 4.567
              07 00 0.00 08 00 0.00 5.678
              end{filecontents}

              begin{document}

              pgfplotstableset{
              begin table=begin{longtable},
              end table=end{longtable},
              }

              pgfplotstableset{
              every head row/.style={output empty row},
              every head row/.append style={before row={%
              caption{The caption}
              label{tab:DataTable}\
              toprule
              multicolumn{3}{c}{textbf{RA}} & multicolumn{3}{c}{textbf{Dec}} & multicolumn{1}{c}{textbf{S}} \
              multicolumn{3}{c}{bfseries hh:mm:ss} & multicolumn{3}{c}{bfseries deg:min:sec} & multicolumn{1}{c}{textbf{mJy}}
              \
              midrule
              endfirsthead
              multicolumn{7}{c}{tablename thetable{} -- continued from}\
              multicolumn{7}{c}{previous page}\[1ex]
              toprule
              multicolumn{3}{c}{textbf{RA}} & multicolumn{3}{c}{textbf{Dec}} & multicolumn{1}{c}{textbf{S}} \
              multicolumn{3}{c}{bfseries hh:mm:ss} & multicolumn{3}{c}{bfseries deg:min:sec} & multicolumn{1}{c}{textbf{mJy}}
              \
              midrule
              endhead
              midrule
              multicolumn{7}{r}{Continued on next page}\
              endfoot
              bottomrule
              endlastfoot
              },
              },
              }

              pgfplotstabletypeset[col sep=space,
              columns/0/.style={string type,column type=r,column type/.add={>{phantom{.}}}{@{:}}},
              columns/1/.style={string type,column type=c,column type/.add={}{@{:}}},
              columns/2/.style={string type,column type=l},
              columns/3/.style={string type,column type=r,column type/.add={>{phantom{0.}}}{@{:}}},
              columns/4/.style={string type,column type=c,column type/.add={}{@{:}}},
              columns/5/.style={string type,column type=l},
              columns/6/.style={string type,column type={S[table-format=1.2, round-mode=places,
              round-precision=2]}}
              ]{data.txt}

              end{document}


              First page:



              enter image description here



              Second page:



              enter image description here






              share|improve this answer


























                0












                0








                0







                I'd opt for suggestion #2, with @{:} as a separator when needed.



                I also add some phantoms to adjust alignment.



                documentclass[a5paper]{article}
                usepackage{array}
                usepackage{pgfplotstable}
                pgfplotsset{compat=1.15}
                usepackage{booktabs}
                usepackage{longtable}
                usepackage{siunitx}

                usepackage{filecontents}
                begin{filecontents}{data.txt}
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                end{filecontents}

                begin{document}

                pgfplotstableset{
                begin table=begin{longtable},
                end table=end{longtable},
                }

                pgfplotstableset{
                every head row/.style={output empty row},
                every head row/.append style={before row={%
                caption{The caption}
                label{tab:DataTable}\
                toprule
                multicolumn{3}{c}{textbf{RA}} & multicolumn{3}{c}{textbf{Dec}} & multicolumn{1}{c}{textbf{S}} \
                multicolumn{3}{c}{bfseries hh:mm:ss} & multicolumn{3}{c}{bfseries deg:min:sec} & multicolumn{1}{c}{textbf{mJy}}
                \
                midrule
                endfirsthead
                multicolumn{7}{c}{tablename thetable{} -- continued from}\
                multicolumn{7}{c}{previous page}\[1ex]
                toprule
                multicolumn{3}{c}{textbf{RA}} & multicolumn{3}{c}{textbf{Dec}} & multicolumn{1}{c}{textbf{S}} \
                multicolumn{3}{c}{bfseries hh:mm:ss} & multicolumn{3}{c}{bfseries deg:min:sec} & multicolumn{1}{c}{textbf{mJy}}
                \
                midrule
                endhead
                midrule
                multicolumn{7}{r}{Continued on next page}\
                endfoot
                bottomrule
                endlastfoot
                },
                },
                }

                pgfplotstabletypeset[col sep=space,
                columns/0/.style={string type,column type=r,column type/.add={>{phantom{.}}}{@{:}}},
                columns/1/.style={string type,column type=c,column type/.add={}{@{:}}},
                columns/2/.style={string type,column type=l},
                columns/3/.style={string type,column type=r,column type/.add={>{phantom{0.}}}{@{:}}},
                columns/4/.style={string type,column type=c,column type/.add={}{@{:}}},
                columns/5/.style={string type,column type=l},
                columns/6/.style={string type,column type={S[table-format=1.2, round-mode=places,
                round-precision=2]}}
                ]{data.txt}

                end{document}


                First page:



                enter image description here



                Second page:



                enter image description here






                share|improve this answer













                I'd opt for suggestion #2, with @{:} as a separator when needed.



                I also add some phantoms to adjust alignment.



                documentclass[a5paper]{article}
                usepackage{array}
                usepackage{pgfplotstable}
                pgfplotsset{compat=1.15}
                usepackage{booktabs}
                usepackage{longtable}
                usepackage{siunitx}

                usepackage{filecontents}
                begin{filecontents}{data.txt}
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                01 00 0.00 02 00 0.00 3.456
                04 00 0.00 05 00 0.00 4.567
                07 00 0.00 08 00 0.00 5.678
                end{filecontents}

                begin{document}

                pgfplotstableset{
                begin table=begin{longtable},
                end table=end{longtable},
                }

                pgfplotstableset{
                every head row/.style={output empty row},
                every head row/.append style={before row={%
                caption{The caption}
                label{tab:DataTable}\
                toprule
                multicolumn{3}{c}{textbf{RA}} & multicolumn{3}{c}{textbf{Dec}} & multicolumn{1}{c}{textbf{S}} \
                multicolumn{3}{c}{bfseries hh:mm:ss} & multicolumn{3}{c}{bfseries deg:min:sec} & multicolumn{1}{c}{textbf{mJy}}
                \
                midrule
                endfirsthead
                multicolumn{7}{c}{tablename thetable{} -- continued from}\
                multicolumn{7}{c}{previous page}\[1ex]
                toprule
                multicolumn{3}{c}{textbf{RA}} & multicolumn{3}{c}{textbf{Dec}} & multicolumn{1}{c}{textbf{S}} \
                multicolumn{3}{c}{bfseries hh:mm:ss} & multicolumn{3}{c}{bfseries deg:min:sec} & multicolumn{1}{c}{textbf{mJy}}
                \
                midrule
                endhead
                midrule
                multicolumn{7}{r}{Continued on next page}\
                endfoot
                bottomrule
                endlastfoot
                },
                },
                }

                pgfplotstabletypeset[col sep=space,
                columns/0/.style={string type,column type=r,column type/.add={>{phantom{.}}}{@{:}}},
                columns/1/.style={string type,column type=c,column type/.add={}{@{:}}},
                columns/2/.style={string type,column type=l},
                columns/3/.style={string type,column type=r,column type/.add={>{phantom{0.}}}{@{:}}},
                columns/4/.style={string type,column type=c,column type/.add={}{@{:}}},
                columns/5/.style={string type,column type=l},
                columns/6/.style={string type,column type={S[table-format=1.2, round-mode=places,
                round-precision=2]}}
                ]{data.txt}

                end{document}


                First page:



                enter image description here



                Second page:



                enter image description here







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jul 3 '18 at 11:11









                CarLaTeXCarLaTeX

                36.1k556153




                36.1k556153






























                    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%2f438555%2fpgfplotstable-how-to-get-numbers-in-a-column-to-be-formatted-with-colons-and-a%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

                    El tren de la libertad Índice Antecedentes "Porque yo decido" Desarrollo de la...

                    Castillo d'Acher Características Menú de navegación

                    Connecting two nodes from the same mother node horizontallyTikZ: What EXACTLY does the the |- notation for...