3

i want to print the following lines (including the spaces) into my latex document. But there is always, of course, a problem with those spaces:

Name: SD
Type: SDHC/SDXC
Speed: default speed
Size: 7691MB
CSD: ver=1, sector_size=512, capacity=15751168 read_bl_len=9
SCR: sd_spec=2, bus_width=5
  sector  | count | align | size(kB)  | wr_time(ms) | wr_speed(MB/s)  |  rd_time(ms)  | rd_speed(MB/s)
        0 |    1  |   4   |     0.5   |     2.38    |       0.21      |      0.56     |      0.87
        0 |    4  |   4   |     2.0   |     2.76    |       0.71      |      1.33     |      1.47
        1 |   16  |   4   |     8.0   |     5.09    |       1.53      |      3.79     |      2.06
       16 |   32  |   4   |    16.0   |     8.94    |       1.75      |      7.09     |      2.21
       48 |   64  |   4   |    32.0   |    15.58    |       2.01      |     13.66     |      2.29
      128 |  128  |   4   |    64.0   |    27.73    |       2.25      |     26.87     |      2.33
 15751104 |   32  |   4   |    16.0   |     7.87    |       1.98      |      7.09     |      2.20
 15751104 |   64  |   4   |    32.0   |    14.44    |       2.16      |     13.67     |      2.29
 15751160 |    1  |   4   |     0.5   |     2.30    |       0.21      |      0.58     |      0.84
  7875584 |    1  |   4   |     0.5   |     2.29    |       0.21      |      0.58     |      0.84
  7875584 |    4  |   4   |     2.0   |     2.76    |       0.71      |      1.33     |      1.46
  7875584 |    8  |   4   |     4.0   |     3.51    |       1.11      |      2.16     |      1.81
  7875584 |   16  |   4   |     8.0   |     5.25    |       1.49      |      3.81     |      2.05
  7875584 |   32  |   4   |    16.0   |     7.79    |       2.01      |      7.09     |      2.20
  7875584 |   64  |   4   |    32.0   |    14.44    |       2.16      |     13.67     |      2.29
  7875584 |  128  |   4   |    64.0   |    41.28    |       1.51      |     26.88     |      2.33
  7875584 |    1  |   1   |     0.5   |     2.18    |       0.22      |      0.59     |      0.83
  7875584 |    8  |   1   |     4.0   |    13.29    |       0.29      |      4.57     |      0.86
  7875584 |  128  |   1   |    64.0   |   213.76    |       0.29      |     73.11     |      0.85

How am i able to do this? I dont want to screenshot this thing.

I'm talking about those space (visible):

··sector··|·count·|·align·|·size(kB)··|·wr_time(ms)·|·wr_speed(MB/s)··|·rd_time(ms)··|·rd_speed(MB/s)
········0 |····1··|···4···|·····0.5···|·····2.38····|······0.21······|······0.56·····|······0.87
4
  • 1
    verbatim or listings? Aug 24, 2017 at 15:25
  • Which spaces are you speaking of?
    – Bernard
    Aug 24, 2017 at 15:28
  • updated the post with visible spaces (i dont want this, the spaces should be invisible!). normaly i'm using listings, but is there a way to just "copypaste" this? So no "code userpackage"? Aug 24, 2017 at 15:48
  • @ipo please update the question with the requirement that you don't want to use listings Aug 24, 2017 at 15:53

3 Answers 3

5

The verbatim environment is available by default. Depending on your page layout you might not need to reduce the font size as much.

\documentclass{article}
\begin{document}
{\tiny % reduce font size
\begin{verbatim}
Name: SD
Type: SDHC/SDXC
Speed: default speed
Size: 7691MB
CSD: ver=1, sector_size=512, capacity=15751168 read_bl_len=9
SCR: sd_spec=2, bus_width=5
  sector  | count | align | size(kB)  | wr_time(ms) | wr_speed(MB/s)  |  rd_time(ms)  | rd_speed(MB/s)
        0 |    1  |   4   |     0.5   |     2.38    |       0.21      |      0.56     |      0.87
        0 |    4  |   4   |     2.0   |     2.76    |       0.71      |      1.33     |      1.47
        1 |   16  |   4   |     8.0   |     5.09    |       1.53      |      3.79     |      2.06
       16 |   32  |   4   |    16.0   |     8.94    |       1.75      |      7.09     |      2.21
       48 |   64  |   4   |    32.0   |    15.58    |       2.01      |     13.66     |      2.29
      128 |  128  |   4   |    64.0   |    27.73    |       2.25      |     26.87     |      2.33
 15751104 |   32  |   4   |    16.0   |     7.87    |       1.98      |      7.09     |      2.20
 15751104 |   64  |   4   |    32.0   |    14.44    |       2.16      |     13.67     |      2.29
 15751160 |    1  |   4   |     0.5   |     2.30    |       0.21      |      0.58     |      0.84
  7875584 |    1  |   4   |     0.5   |     2.29    |       0.21      |      0.58     |      0.84
  7875584 |    4  |   4   |     2.0   |     2.76    |       0.71      |      1.33     |      1.46
  7875584 |    8  |   4   |     4.0   |     3.51    |       1.11      |      2.16     |      1.81
  7875584 |   16  |   4   |     8.0   |     5.25    |       1.49      |      3.81     |      2.05
  7875584 |   32  |   4   |    16.0   |     7.79    |       2.01      |      7.09     |      2.20
  7875584 |   64  |   4   |    32.0   |    14.44    |       2.16      |     13.67     |      2.29
  7875584 |  128  |   4   |    64.0   |    41.28    |       1.51      |     26.88     |      2.33
  7875584 |    1  |   1   |     0.5   |     2.18    |       0.22      |      0.59     |      0.83
  7875584 |    8  |   1   |     4.0   |    13.29    |       0.29      |      4.57     |      0.86
  7875584 |  128  |   1   |    64.0   |   213.76    |       0.29      |     73.11     |      0.85
\end{verbatim}
}% end of font size change
\end{document}
6

Here's a starting point using listings

\documentclass{standalone}
\usepackage{listings}
\begin{document}
\begin{lstlisting}[language=bash]
Name: SD
Type: SDHC/SDXC
Speed: default speed
Size: 7691MB
CSD: ver=1, sector_size=512, capacity=15751168 read_bl_len=9
SCR: sd_spec=2, bus_width=5
 sector  | count | align | size(kB)  | wr_time(ms) | wr_speed(MB/s)  |  rd_time(ms)  | rd_speed(MB/s)
       0 |    1  |   4   |     0.5   |     2.38    |       0.21      |      0.56     |      0.87
       0 |    4  |   4   |     2.0   |     2.76    |       0.71      |      1.33     |      1.47
       1 |   16  |   4   |     8.0   |     5.09    |       1.53      |      3.79     |      2.06
      16 |   32  |   4   |    16.0   |     8.94    |       1.75      |      7.09     |      2.21
      48 |   64  |   4   |    32.0   |    15.58    |       2.01      |     13.66     |      2.29
     128 |  128  |   4   |    64.0   |    27.73    |       2.25      |     26.87     |      2.33
15751104 |   32  |   4   |    16.0   |     7.87    |       1.98      |      7.09     |      2.20
15751104 |   64  |   4   |    32.0   |    14.44    |       2.16      |     13.67     |      2.29
15751160 |    1  |   4   |     0.5   |     2.30    |       0.21      |      0.58     |      0.84
 7875584 |    1  |   4   |     0.5   |     2.29    |       0.21      |      0.58     |      0.84
 7875584 |    4  |   4   |     2.0   |     2.76    |       0.71      |      1.33     |      1.46
 7875584 |    8  |   4   |     4.0   |     3.51    |       1.11      |      2.16     |      1.81
 7875584 |   16  |   4   |     8.0   |     5.25    |       1.49      |      3.81     |      2.05
 7875584 |   32  |   4   |    16.0   |     7.79    |       2.01      |      7.09     |      2.20
 7875584 |   64  |   4   |    32.0   |    14.44    |       2.16      |     13.67     |      2.29
 7875584 |  128  |   4   |    64.0   |    41.28    |       1.51      |     26.88     |      2.33
 7875584 |    1  |   1   |     0.5   |     2.18    |       0.22      |      0.59     |      0.83
 7875584 |    8  |   1   |     4.0   |    13.29    |       0.29      |      4.57     |      0.86
 7875584 |  128  |   1   |    64.0   |   213.76    |       0.29      |     73.11     |      0.85
\end{lstlisting}
\end{document}

then you can format the output as you prefer with the \lstset{} command.

2
  • 1
    for the record, I posted the answer before @ipo specified that he preferred to do this without using listings ;) Aug 24, 2017 at 15:52
  • Yep, but this is also a good way. So thanks, anyway. :) Aug 24, 2017 at 16:00
3

You can adjust several parameters, but this is a starting point.

\documentclass{article}
\usepackage{siunitx,booktabs}

\begin{document}

\begin{table}
\centering

\begin{tabular}{
  @{}
  S[table-format=8.0]
  S[table-format=3.0]
  S[table-format=1.0]
  S[table-format=2.1]
  S[table-format=3.2]
  S[table-format=1.2]
  S[table-format=2.2]
  S[table-format=1.2]
  @{}
}
\multicolumn{8}{l}{Name: SD} \\
\multicolumn{8}{l}{Type: SDHC/SDXC} \\
\multicolumn{8}{l}{Speed: default speed} \\
\multicolumn{8}{l}{Size: \SI{7691}{MB}} \\
\multicolumn{8}{l}{CSD: ver=1, sector\_size = 512, capacity = \num{15751168}, read\_bl\_len = 9} \\
\multicolumn{8}{l}{SCR: sd\_spec = 2, bus\_width = 5} \\
\addlinespace
\midrule[\heavyrulewidth]
{sector} & {count} & {align} & {size} & {wr\_time} & {wr\_speed} & {rd\_time}  & {rd\_speed} \\
 & & {(\si{kB})} & {(\si{ms})} & {(\si{ms})} & {(\si{MB/s})} & {(\si{ms})} & {(\si{MB/s})} \\
\midrule
        0 &    1  &   4   &     0.5   &     2.38    &       0.21      &      0.56     &      0.87 \\
        0 &    4  &   4   &     2.0   &     2.76    &       0.71      &      1.33     &      1.47 \\
        1 &   16  &   4   &     8.0   &     5.09    &       1.53      &      3.79     &      2.06 \\
       16 &   32  &   4   &    16.0   &     8.94    &       1.75      &      7.09     &      2.21 \\
       48 &   64  &   4   &    32.0   &    15.58    &       2.01      &     13.66     &      2.29 \\
      128 &  128  &   4   &    64.0   &    27.73    &       2.25      &     26.87     &      2.33 \\
 15751104 &   32  &   4   &    16.0   &     7.87    &       1.98      &      7.09     &      2.20 \\
 15751104 &   64  &   4   &    32.0   &    14.44    &       2.16      &     13.67     &      2.29 \\
 15751160 &    1  &   4   &     0.5   &     2.30    &       0.21      &      0.58     &      0.84 \\
  7875584 &    1  &   4   &     0.5   &     2.29    &       0.21      &      0.58     &      0.84 \\
  7875584 &    4  &   4   &     2.0   &     2.76    &       0.71      &      1.33     &      1.46 \\
  7875584 &    8  &   4   &     4.0   &     3.51    &       1.11      &      2.16     &      1.81 \\
  7875584 &   16  &   4   &     8.0   &     5.25    &       1.49      &      3.81     &      2.05 \\
  7875584 &   32  &   4   &    16.0   &     7.79    &       2.01      &      7.09     &      2.20 \\
  7875584 &   64  &   4   &    32.0   &    14.44    &       2.16      &     13.67     &      2.29 \\
  7875584 &  128  &   4   &    64.0   &    41.28    &       1.51      &     26.88     &      2.33 \\
  7875584 &    1  &   1   &     0.5   &     2.18    &       0.22      &      0.59     &      0.83 \\
  7875584 &    8  &   1   &     4.0   &    13.29    &       0.29      &      4.57     &      0.86 \\
  7875584 &  128  &   1   &    64.0   &   213.76    &       0.29      &     73.11     &      0.85 \\
\bottomrule
\end{tabular}

\end{table}

\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .