1

I have been trying to solve this for a while and i could't. I have two questions for you:

How can I set the table to float on the page? I mean, why is not in the top of it? there is a lot of space there, and i thought that with the [h] tag that should happen.

How can I set automatically set the width of the "Descripcion" field? It is out of the page? It should be splited in two lines.

Same thing with the "accion" header, how can i make the content fits in all the space?

Here is my code:

\begin{table}[ht]
\begin{tabularx}{\textwidth}{|X|X|X|}
\hline
\textbf{Nombre}                                                     & \multicolumn{2}{c|}{Elegir categoría}                                                                               \\ \hline
\textbf{Actor}                                                      & \multicolumn{2}{c|}{Alumno}                                                                                         \\ \hline
\textbf{Descripción}                                                & \multicolumn{2}{c|}{El sistema deberá permitir al usuario elegir entre las categorías generales}                    \\ \hline
\textbf{Precondición}                                               & \multicolumn{2}{c|}{Haber iniciado la aplicación}                                                                   \\ \hline
\multicolumn{1}{|c|}{\multirow{2}{*}{\textbf{Secuencia principal}}} & \textbf{Paso} & \textbf{Acción}                                                                                     \\ \cline{2-3} 
\multicolumn{1}{|X|}{}                                              & 1             & El usuario deberá elegir con las flechas del teclado (izquierda y derecha) o el mouse una categoría \\ \hline
\end{tabularx}
        \caption{Especificación de caso de uso \textit{Elegir categoría}}
        \label{tabla:diagramageneralelegircategoria}
\end{table}

enter image description here

1
  • Welcome to TeX.SX! Can you please expand the code snippet that you have posted to a full minimal working example. It is much easier to help you if we can start with some compilable code that illustrates your problem. A MWE should start with a \documentclass command, include any necessary packages and be as small as possible to demonstrate your problem. At the moment we have to guess what you are doing because we cannot reproduce your problem from the code that you have given us.
    – user30471
    Dec 6, 2018 at 5:22

1 Answer 1

3

i suspect, that you looking for something like this:

enter image description here

(red lines indicate page layout)

    \begin{table}[ht]
    \begin{tabularx}{\textwidth}{|X|X|X|}
        \hline
    \textbf{Nombre}         & \multicolumn{2}{c|}{Elegir categoría} \\
        \hline
    \textbf{Actor}          & \multicolumn{2}{c|}{Alumno}           \\
        \hline
    \textbf{Descripción}    & \multicolumn{2}{>{\hsize=\dimexpr2\hsize+2\tabcolsep}X|}{%
                              El sistema deberá permitir al usuario elegir entre las categorías generales}                                       \\
        \hline
    \textbf{Precondición}   & \multicolumn{2}{c|}{Haber iniciado la aplicación} \\
        \hline
    \multirow{2}{=}{\textbf{Secuencia principal}}
                            & \textbf{Paso}         & \textbf{Acción}           \\
        \cline{2-3}
                            & 1                     & El usuario deberá elegir con las flechas del teclado (izquierda y derecha) o el mouse una categoría \\
        \hline
    \end{tabularx}
            \caption{Especificación de caso de uso \textit{Elegir categoría}}
            \label{tabla:diagramageneralelegircategoria}
    \end{table}

note: your problem is wrong use of \multicolumn{1}{l|}{...} its contain is to long, consequently it spill out of table and text area.

You must log in to answer this question.

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