1

In first, the one with "process id", I thought this can be done with table but don't know how.

and in the second one, I thought of equation in this but could not figure out how can I place the data outside the Matrix and also there is no representation of equation on the left side of it

Mico
  • 506,678
Ap00rv
  • 13
  • Welcome to TeX.SX! Please ask only one question. It would help to see add a minimal working example (MWE), that illustrates your problem. The compilable code, starts with \documentclass and ends with \end{document}. Related question https://tex.stackexchange.com/a/63887/124842 (first question), https://tex.stackexchange.com/a/130799/124842 (secondquestion) – Bobyandbob Jul 01 '17 at 13:26
  • @Bobyandbob thanks for your help and suggestion, will keep them in mind next time.... – Ap00rv Jul 01 '17 at 13:45
  • @Ap00 Your question will probably be unanswered if you do not provide a MWE. – berkus Jul 01 '17 at 16:12
  • @BarisErkus Yeah okay but, my question was answered by the comment made by Bobyandbob. If it really matters I can provide MWE with it ... – Ap00rv Jul 01 '17 at 19:34
  • No need, if those questions solved your problem we'll close as duplicate. – Torbjørn T. Jul 02 '17 at 06:57

1 Answers1

3

I perceive two main challenges with the first table:

  • How to make it fit inside the textblock? A basic tabular environment gives no guarantee that this 17-column table will actually fit.

  • How to typeset the header line ("Process ID...")?

To meet these challenges, I suggest you employ (a) a tabular* environment whose width is set to \textwidth and (b) a \multicolumn directive, as is done in the code below. Incidentally, I would right-align rather than left-align the numbers.

A third challenge could be how to render the entire tabular material with a light-gray background. In the code below, I've used the technique proposed in this answer to address this challenge.

Regarding the second table, I'd say it's not right to set up the numeric material as a (mathematical) matrix surrounded by curly braces. What's far more important is to line up the header cells with their corresponding columns. Separately, I'd also say that it's important -- for the sake of legibility -- to align the numbers on their respective decimal markers. I would therefore use a tabular environment along with the S column type of the siunitx package for the four "real" data columns.

enter image description here

\documentclass{article}
\usepackage{booktabs,siunitx,xcolor}
\definecolor{lightgray}{gray}{0.85} % define a suitable version of "light gray"
\newcommand\mytab[1]{\smash{%
   \begin{tabular}[t]{@{}c@{}}#1\end{tabular}}}

\begin{document}

\noindent
\begingroup % localize scope of next two instructions
\setlength\tabcolsep{0pt} % make LaTeX figure out inter-column whitespace
\setlength\fboxsep{0pt}   % see https://tex.stackexchange.com/a/63897/5001
\colorbox{lightgray}{%
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} *{17}{r}}
\toprule
\multicolumn{6}{@{}l}{Process ID: 3939}\\[0.5ex]
105 & 104& 104& 106& 105& 104& 104& 106& 105& 104& 104& 106& 5& 4& 5& 5 &0 \\
40 & 41 & \dots \\
3  &  3 & \dots \\
3  & 12 & \dots \\
\bottomrule
\end{tabular*}}
\endgroup

\bigskip

\begin{center}
\begin{tabular}{@{}c *{2}{S[table-format=1.3]} 
    c *{2}{S[table-format=1.3]} @{}}
\toprule
\mytab{Distinct\\System Call} & 
\multicolumn{5}{c}{Trace} \\
\cmidrule(l){2-6}
  & {1}   & {2}   &       & {$m-1$} & {$m$}   \\
\midrule
1  & 0.051  & 0.055  & \dots  & 0.049 & 0.051 \\
2  & 0.122  & 0.125  & \dots  & \\
   &{\vdots}&{\vdots}&{\vdots}& \\
155& 0.101  & 0.1    & \dots  & \\
167& 0.03   & 0.03   & \dots  & 0.02  & 0.03  \\
\bottomrule
\end{tabular}
\end{center}

\end{document}
Mico
  • 506,678
  • Thanks a lot for your help and much-needed advice about data representation.... Actually, I was writing it in a 2 column IEEE journal format so the first table would not fit inside it...so should I just reduce this one's size...??

    P.S - Never mind just chaged \textwidth to \linewidth and now it fits

    – Ap00rv Jul 03 '17 at 10:35