0

I am using Tex Studio on Windows 10. Here is the simple code which I am executing

\documentclass{article}
%\usepackage{siunitx}
%\sisetup{
%round-mode = places,
%round-precision = 2, 
%}

\begin{document}
\begin{table}[h!]
\begin{center}

\begin{tabularx}{| X | X | X |}
\hline
\textbf{Value 1} & \textbf{Value 2} & \textbf{Value 3}\\
$\alpha$ & $\beta$ & $\gamma$ \\
\hline
1 & 1110.1 & a \\
2 & 10.1  & b \\
3 & 23.113231 & c \\
\hline
\end{tabularx}
\end{center}
\caption{Your first label}
\label{tab:table1}
\end{table}

\begin{table} [h!]
\begin{center}
\begin{tabular}{|r | l |}
    \hline
    7C0 & hexadecimal \\
    3700 & octal \\
    \cline{2-2}} 11111000000 & binary \\
    \hline
\end{tabular}
\end{center}
\caption{Your second label}
\label{tab:table2}
\end{table}


\begin{tabular}{cc}
    boring cell content & \parbox[t]{5cm}{rather long par\\new par}
\end{tabular}

\end{document}

I clicked the arrow
out put generation
the arrow which is double generates the preview.I have previously written paper in latex and used Tex studio. The same laptop and same setup. So I know it does not take this long time for simple code to compile and generate a preview pdf. What I am doing is very simple I am not clear with usage of tabular in latex so I am trying to practise with it by example codes given https://en.wikibooks.org/wiki/LaTeX/Tables#The_tabularx_package and https://www.latex-tutorial.com/tutorials/tables/ so my programs are very simple sinppets of code which I am trying to practise. The code posted in above should not at all take a very very long time to compile. So what is the problem I am not able to understand. Here is a preview of settings if this helps
settings page

as suggested in comments I looked at the error messages here are the error messages

Environment tabularx undefined. \begin{tabularx}
Misplaced \noalign. \hline
Misplaced alignment tab character &. \textbf{Value 1} &
Misplaced alignment tab character &. \textbf{Value 1} & \textbf{Value 2} &
Misplaced alignment tab character &. $\alpha$ &
Misplaced alignment tab character &. $\alpha$ & $\beta$ &
Misplaced \noalign. \hline
Misplaced alignment tab character &. 1 &
Misplaced alignment tab character &. 1 & 1110.1 &
Misplaced alignment tab character &. 2 &
Misplaced alignment tab character &. 2 & 10.1 &
Misplaced alignment tab character &. 3 &
Misplaced alignment tab character &. 3 & 23.113231 &
Misplaced \noalign. \hline
\begin{center} on input line 10 ended by \end{tabularx}. \end{tabularx}
Misplaced alignment tab character &. \cline{2-2}} 11111000000 &

as mentioned in comments I removed extra bracket in cline and included package tabularx

\documentclass{article}
%\usepackage{siunitx}
%\sisetup{
%round-mode = places,
%round-precision = 2, 
%}

\usepackage{tabularx}
\begin{document}
\begin{table}[h!]
\begin{center}

\begin{tabularx}{| X | X | X |}
\hline
\textbf{Value 1} & \textbf{Value 2} & \textbf{Value 3}\\
$\alpha$ & $\beta$ & $\gamma$ \\
\hline
1 & 1110.1 & a \\
2 & 10.1  & b \\
3 & 23.113231 & c \\
\hline
\end{tabularx}
\end{center}
\caption{Your first label}
\label{tab:table1}
\end{table}
Second table
\begin{table} [h!]
\begin{center}
\begin{tabular}{|r | l |}
    \hline
    7C0 & hexadecimal \\
    3700 & octal \\
    \cline{2-2} 11111000000 & binary \\
    \hline
\end{tabular}
\end{center}
\caption{Your second label}
\label{tab:table2}
\end{table}


\begin{tabular}{cc}
    boring cell content & \parbox[t]{5cm}{rather long par\\new par}
\end{tabular}

\end{document}

now the errors I have are

line 12: Environment tabularx undefined. \begin{tabularx}
line 13: Misplaced \noalign. \hline
line 14: Misplaced alignment tab character &. \textbf{Value 1} &
line 14: Misplaced alignment tab character &. \textbf{Value 1} & \textbf{Value 2} &
line 15: Misplaced alignment tab character &. $\alpha$ &
line 15: Misplaced alignment tab character &. $\alpha$ & $\beta$ &
line 16: Misplaced \noalign. \hline
line 17: Misplaced alignment tab character &. 1 &
line 17: Misplaced alignment tab character &. 1 & 1110.1 &
line 18: Misplaced alignment tab character &. 2 &
line 18: Misplaced alignment tab character &. 2 & 10.1 &
line 19: Misplaced alignment tab character &. 3 &
line 19: Misplaced alignment tab character &. 3 & 23.113231 &
line 20: Misplaced \noalign. \hline
line 21: \begin{center} on input line 10 ended by \end{tabularx}. \end{tabularx}
line 33: Misplaced alignment tab character &. \cline{2-2}} 11111000000 &

the tex studio shows following in red
table errors
and following
cline errors

9
  • Your code is faulty. It does not compile at all.
    – DG'
    Commented May 8, 2020 at 9:01
  • ohh what is the mistake please tell.
    – koeradoera
    Commented May 8, 2020 at 9:03
  • Your editor should show your errors at the bottom. You can also look in the log-file, it should show errors too. Commented May 8, 2020 at 9:06
  • 2
    For starters: You need to follow the examples more closely and load the package tabularx, etc.
    – DG'
    Commented May 8, 2020 at 9:08
  • 2
    also an extra bracket in cline
    – js bibra
    Commented May 8, 2020 at 9:24

2 Answers 2

0

The red quadratic, buttom in Texstudio shows, that the compiling is running. When you want to cancel the process, press the red quadratic buttom. Then the compiling buttom will be green. If you use Miktex with installing "packages on the fly", then the compiling time get longer, when packages will be installed.

7
  • ok yes this is the thing packages are installed on the fly. How can this be changed .
    – koeradoera
    Commented May 8, 2020 at 11:43
  • In the Miktex Console ( under settigs) you can disable the "installing on the fly". But then you must install missing packages also in the Miktex Console manually.
    – uli
    Commented May 8, 2020 at 12:29
  • is it possible to have all packages pre installed by some option whether I know the name or not
    – koeradoera
    Commented May 8, 2020 at 12:30
  • You can install all missing packages also in the Miktex Console (under packages). At first you can sort the packages in installed and uninstalled by pressing the field "installed on". Then you can mark all not installed packages by "Shift-End" and then press the blue plus buttom at the top of the window.
    – uli
    Commented May 8, 2020 at 12:35
  • Ok I checked the console as you say i.imgur.com/ULmebyK.jpg[ but there does not seem to be an option of seeing not installed packages.
    – koeradoera
    Commented May 8, 2020 at 12:50
0

enter image description here

\documentclass{article}
\usepackage{tabularx}
\usepackage{siunitx}
\usepackage{booktabs}
\sisetup{table-format=4.6,
round-mode = places,
round-precision = 2, 
}

\begin{document}
    \begin{table}
    \centering
            \begin{tabularx}{0.5\textwidth}{| c | S | c |}
                \textbf{Value 1} & \textbf{Value 2} & \textbf{Value 3}\\
                $\alpha$ & $\beta$ & $\gamma$ \\
                1 & 1110.1 & a \\
                2 & 10.1  & b \\
                3 & 23.113231 & c \\
            \end{tabularx}
        \caption{Your first label}
        \label{tab:table1}
    \vspace*{1cm}   
            \begin{tabular}{|r | l |}   \hline
                7C0 & hexadecimal \\
                3700 & octal \\ \cline{2-2}
                11111000000 & binary \\     \hline
        \end{tabular} \\[1cm]

        \begin{tabular}{cc}
            boring cell content & \parbox[t]{5cm}{rather long par\\new par}
        \end{tabular}
    \end{table}
\end{document}
1
  • I copy pasted the whole code you mentioned here in my tex studio ide the option to compile is greyed out. Here is a screenshot imgur.com/u3eDW8U and more over the package siunitx is not present in my installation. I am not clear what is wrong, I had yesterday posted a question about not being able to use siunitx tex.stackexchange.com/questions/542773/… I am not able to understand how should I check the error regarding siunitx.How to fix this.
    – koeradoera
    Commented May 8, 2020 at 9:46

You must log in to answer this question.

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