Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Formatting text inside tables in LyX (LaTeX Editor)

Options
  • 08-09-2009 4:09pm
    #1
    Closed Accounts Posts: 5,284 ✭✭✭


    I am trying to reproduce a table in LyX. It has headings for different subjects within the table (not in the first row). I do not see how to apply formatting to indicate these inside the table however. I don't see how to do this in the LyX wiki either.
    Does anyone know how to do this?

    edit: At the moment I'm just using multiliple columns for the header-type text, which seems to work (kinda) ok.


Comments

  • Registered Users Posts: 13,104 ✭✭✭✭djpbarry


    I'm not sure I understand what you're trying to do, but this might be of some use:

    http://en.wikibooks.org/wiki/LaTeX/Tables


  • Registered Users Posts: 404 ✭✭DemocAnarchis


    Not too sure what you mean either, shouldn't it be under Edit > Text Style > Customised? Maybe if you posted a link to a similar table here we could help.


  • Closed Accounts Posts: 5,284 ✭✭✭pwd


    Not too sure what you mean either, shouldn't it be under Edit > Text Style > Customised? Maybe if you posted a link to a similar table here we could help.
    Thanks that allowed me to make the text bold.
    But I would like to have two lines of text in the same cell. Do you know how to do that?


  • Registered Users Posts: 13,104 ✭✭✭✭djpbarry


    pwd wrote: »
    But I would like to have two lines of text in the same cell. Do you know how to do that?
    Could you post some of the LaTex code you're using for your table, together with an example of the sort of table you're trying to create? I don't use LyX, but 'cells' are not something that LaTex creates in a tabular environment unless instructed to do so (by using \hline and \cline for example).


  • Closed Accounts Posts: 5,284 ✭✭✭pwd


    \begin{longtable}{|l|c|c|}
    \label{Table 1}SourceResults \cite{Source}\tabularnewline
    \cline{2-3}
    \multicolumn{1}{l|}{} & \% {}``often'' to {}``significant'' (5-7 on 1-7 scale) & Mean / (Std. Deviation\tabularnewline
    \hline
    \multicolumn{3}{|l|}{\textbf{Subheader: }{}``Question':}\tabularnewline

    "Subheader", marked in bold above, should be a different line in the same cell of the table to "Question".


  • Advertisement
  • Banned (with Prison Access) Posts: 261 ✭✭blucey


    pwd wrote: »
    "Subheader", marked in bold above, should be a different line in the same cell of the table to "Question".

    or you could use word.....why do people insist on torturing themselves with latex?


  • Closed Accounts Posts: 2,208 ✭✭✭Économiste Monétaire


    blucey wrote: »
    or you could use word.....why do people insist on torturing themselves with latex?
    Because Word is a steaming pile of shite?


  • Banned (with Prison Access) Posts: 261 ✭✭blucey


    Because Word is a steaming pile of shite?

    n, thats not it...served me well so far. So yah boo sux to you and yer latex....

    Seriously - word sucks only if you dont use it properly. Which most people dont.


  • Closed Accounts Posts: 5,284 ✭✭✭pwd


    Word is fine. LaTeX is fine. Graphical editors such as LyX make it very straightforward to use generally. Given this is a postgrad forum, most people on it will be using one or the other based on the norms where they are doing their study, or their supervisor's ideas on the matter or because of needing specific features in one or the other. An argument about one or the other being crap is irrelevant.


  • Registered Users Posts: 13,104 ✭✭✭✭djpbarry


    pwd wrote: »
    "Subheader", marked in bold above, should be a different line in the same cell of the table to "Question".
    I totally forgot about this - could you maybe provide a rough sketch of what you want your table to look like?


  • Advertisement
  • Registered Users Posts: 64 ✭✭dahak


    If you're just looking to put a new line into a table cell then a parbox might be the way to go.
    You insert the par box (Insert -> Box and change the box type from minbox to parbox).
    You can input text into a parbox as normal including new lines. There are some limitations to what can go into a parbox, offhand I can't remember the exact details but check the documation for more info.

    I imported the Latex code into Lyx (1.6.3 on OSX in case that matters) so it looks slightly different to pwd's posted code.

    This is the Latex code from the preview window in Lyx, followed by a screenshot of Lyx and what the generated pdf looks like at the end.
    \begin{longtable}{l|c|c|}
    \multicolumn{1}{|l|}{\label{Table 1}SourceResults \cite{Source}} &  & \tabularnewline
    \cline{2-3} 
    \multicolumn{1}{l|}{} & \% {}``often'' to {}``significant'' (5-7 on 1-7 scale)  & Mean / (Std. Deviation\tabularnewline
    \hline 
    \multicolumn{3}{|l|}{\textbf{}%
    \parbox[t]{1\columnwidth}{%
    \textbf{Subheader:} 
    
    {}``Question':%
    }}\tabularnewline
    \end{longtable}
    

    [IMG]http://www.boards.ie/vbulletin/attachment.php?attachmentid= 91223[/img]
    [IMG]http://www.boards.ie/vbulletin/attachment.php?attachmentid= 91222[/img]

    lyx_capture1.png

    lyx_pdf_output.png


  • Closed Accounts Posts: 5,284 ✭✭✭pwd


    dahak wrote: »
    If you're just looking to put a new line into a table cell then a parbox might be the way to go.
    You insert the par box (Insert -> Box and change the box type from minbox to parbox).
    You can input text into a parbox as normal including new lines. There are some limitations to what can go into a parbox, offhand I can't remember the exact details but check the documation for more info.

    I imported the Latex code into Lyx (1.6.3 on OSX in case that matters) so it looks slightly different to pwd's posted code.

    This is the Latex code from the preview window in Lyx, followed by a screenshot of Lyx and what the generated pdf looks like at the end.
    \begin{longtable}{l|c|c|}
    \multicolumn{1}{|l|}{\label{Table 1}SourceResults \cite{Source}} &  & \tabularnewline
    \cline{2-3} 
    \multicolumn{1}{l|}{} & \% {}``often'' to {}``significant'' (5-7 on 1-7 scale)  & Mean / (Std. Deviation\tabularnewline
    \hline 
    \multicolumn{3}{|l|}{\textbf{}%
    \parbox[t]{1\columnwidth}{%
    \textbf{Subheader:} 
    
    {}``Question':%
    }}\tabularnewline
    \end{longtable}
    

    [IMG]http://www.boards.ie/vbulletin/attachment.php?attachmentid= 91223[/img]
    [IMG]http://www.boards.ie/vbulletin/attachment.php?attachmentid= 91222[/img]

    lyx_capture1.png

    lyx_pdf_output.png
    Thanks that's exactly what I was trying to do


Advertisement