2

I need to make changes in my table source code, source pane is not editable. Kindly anyone tell me how to make changes in table source code. Your help will be highly appreciated.

See this is my table source code:

\begin{table}[H]
\begin{tabular*}{50cm}{@{\extracolsep{\fill}}|c|c|c|c|c|c|c|}
\hline 
\textbf{Increasing Age Effects} & \textbf{Clothes} & \textbf{Computer Interest} & \textbf{Computer Anxiety} & \textbf{Picky for Food} & \textbf{Motivational Tasks} & \textbf{Kids Interest in Toys}\tabularnewline
\hline 
\hline 
 & Negative Correlation & Negative Correlation & Positive Correlation &  & Negative Correlation & \tabularnewline
\hline 
\textbf{Young Girls} &  &  &  & Positive Correlation &  & \tabularnewline
\hline 
\textbf{Young Boys} &  &  &  & Negative Correlation &  & \tabularnewline
\hline 
\textbf{Baby Girls} &  &  &  &  &  & Negative Correlation\tabularnewline
\hline 
\textbf{Baby Boys} &  &  &  &  &  & Positive Correlation\tabularnewline
\hline 
\end{tabular*}\protect\caption{\textbf{Correlation of Age with Different Interests}}
\end{table}

i want to replace it with this code:

\begin{table}[H]
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}|*{7}{C{0.12\linewidth}|}}
\hline 
\textbf{Increasing Age Effects} & \textbf{Clothes} & \textbf{Computer Interest} & \textbf{Computer Anxiety} & \textbf{Picky for Food} & \textbf{Motivational Tasks} & \textbf{Kids Interest in Toys}\tabularnewline
\hline 
\hline 
 & Negative Correlation & Negative Correlation & Positive Correlation &  & Negative Correlation & \tabularnewline
\hline 
\textbf{Young Girls} &  &  &  & Positive Correlation &  & \tabularnewline
\hline 
\textbf{Young Boys} &  &  &  & Negative Correlation &  & \tabularnewline
\hline 
\textbf{Baby Girls} &  &  &  &  &  & Negative Correlation\tabularnewline
\hline 
\textbf{Baby Boys} &  &  &  &  &  & Positive Correlation\tabularnewline
\hline 
\end{tabular*}\protect\caption{\textbf{Correlation of Age with Different Interests}}
\end{table}
3

1 Answer 1

1

You can't edit the code directly, but you can change the column specifiers to whatever you want. Right click in the table and choose More --> Settings. I guess you will have been here before, to set the width of the table to 50cm.

To set the width to \linewidth, select Line Width % in the list of units, and set the value to 100. (See screenshot below.)

You cannot, I think, use the *{<number>}{<col spec>}, so you would have to do it manually for each column. With the table settings open, click in a cell in the first column. In the field called LaTeX argument type C{0.12\linewidth}, and click Apply. Then, click in a cell in the second column, and repeat. Do the same for all the columns.

enter image description here

The other option you have is to use an ERT. Copy the tabularx environment you have in your question, delete the table in LyX and add an ERT with Ctrl + L instead, and use Edit --> Paste special (Ctrl + Shift + V to paste the code. (Delete only the tabular itself, not the surrounding float.)

I'm assuming here that you have defined the C columntype in the preamble already.

1
  • 2
    @faiza Glad it helped. Note that when you get answers that solve your problem, please consider upvoting (clicking the uparrow left of the answer) and/or accepting (clicking the checkmark) the best answer. Accepting an answer marks the question as solved. Mar 10, 2015 at 20:19

You must log in to answer this question.

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