1

For some reason, the column for all columns except for the first one are cut in half in each line. Here is the code

\begin{tabular}{>{$}c<{$} | >{$}c<{$} | >{$}c<{$} | >{$}c<{$}}
            |v_2| & p_2+\textbf{i}\cdot q_2 & |v_{3}| & q_4  \\
            \hline\\
            1.0300 & -0.4204 + 0.1475i & 0.9400 &  0.5572 \\ \hline \\
            1.0390 & -0.4082 - 0.3263i & 0.9500 &  0.0779 \\ \hline \\
            1.0481 & -0.4122 - 0.7972i & 0.9600 & -0.3905 \\ \hline \\
            1.0571 & -0.4311 - 1.2557i & 0.9700 & -0.8390 
\end{tabular}

And here is the resulting table:

table

It can be clearly seen that something is wrong with the second and third separators.

2

You have presumably-unwanted line break indicators after all 4 \hline statements: Omit them.

If you want a bit more vertical space between rows, consider loading the array package and issuing the directive \setlength\extrarowheight{2pt}.

Separately, since the entire contents of the table are in math mode, consider using an array environment instead of a tabular environment. And, while in math mode, use \mathbf instead of \textbf.

For a more "open" look, consider getting rid of all vertical lines and most horizontal lines; for the horizontal line that divides the header row from the table body, consider using \midrule instead of \hline

A full MWE (minimum working example) that implements both stylistic ideas:

enter image description here

\documentclass{article}
\usepackage{array}    % for "\extrarowheight" macro
\usepackage{booktabs} % for "\midrule" macro
\begin{document}

% Solution 1, with vertical lines and four horizontal lines
\begingroup
\setlength\extrarowheight{2pt} % optional
\[
\begin{array}{c|c|c|r}
            |v_2| & p_2+\mathbf{i}\cdot q_2 & |v_{3}| & \multicolumn{1}{c}{q_4}  \\
            \hline
            1.0300 & -0.4204 + 0.1475i & 0.9400 &  0.5572 \\ \hline
            1.0390 & -0.4082 - 0.3263i & 0.9500 &  0.0779 \\ \hline
            1.0481 & -0.4122 - 0.7972i & 0.9600 & -0.3905 \\ \hline
            1.0571 & -0.4311 - 1.2557i & 0.9700 & -0.8390
\end{array}
\]
\endgroup

% Solution 2, with just 1 horizontal rule 
\[
\begin{array}{@{}cccr@{}}
            |v_2| & p_2+\mathbf{i}\cdot q_2 & |v_{3}| & \multicolumn{1}{c@{}}{q_4}  \\
            \midrule
            1.0300 & -0.4204 + 0.1475i & 0.9400 &  0.5572 \\
            1.0390 & -0.4082 - 0.3263i & 0.9500 &  0.0779 \\
            1.0481 & -0.4122 - 0.7972i & 0.9600 & -0.3905 \\
            1.0571 & -0.4311 - 1.2557i & 0.9700 & -0.8390
\end{array}
\]
\end{document} 
  • adding \def\arraystretch{2} turns the row height to twice the height of a "normal" row – Elad Den Sep 6 '16 at 11:29
  • @EladDen - Thanks. Are you mentioning this instruction as a general possibility, or are you recommending it be applied for the table at hand? – Mico Sep 6 '16 at 11:41
  • a general possibility, there's always more than one way of doing things, and I did not want to add an answer just for that one line :) – Elad Den Sep 6 '16 at 17:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.