0

Goal: enter image description here

What I currently got:

\begin{figure}[tph]
\begin{minipage}[b]{0.6\textwidth}

    \begin{table}[H]
    \begin{tabular}{|l|l|l|l|}
    \hline
    Term       & doc\_1& doc\_2& doc\_3\\ \hline
    largest    & 0.5  & 0.0  & 0.0   \\ \hline
    university & 1.0  & 1.0  & 1.0   \\ \hline
    oldest     & 0.5  & 0.0  & 0.0   \\ \hline
    research   & 0.5  & 0.0  & 0.0   \\ \hline
    1928       & 0.0  & 1.0  & 0.0   \\ \hline
    bjarne     & 0.0  & 0.0  & 1.0   \\ \hline
    founded    & 0.0  & 1.0  & 0.0   \\ \hline
    second     & 0.5  & 0.0  & 0.0   \\ \hline
    denmark    & 0.5  & 1.0  & 0.0   \\ \hline
    stroustrup & 0.0  & 0.0  & 1.0   \\ \hline
    aarhus     & 0.5  & 1.0  & 1.0   \\ \hline
    alumni     & 0.0  & 0.0  & 1.0   \\ \hline
    \end{tabular}
    \end{table}
\end{minipage}

\hfill

\begin{minipage}[b]{0.3\textwidth}
  Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod 
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, 
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo 
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse 
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat 
non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\end{minipage}
\end{figure}
2
  • Another problem in your example: Inside minipage, you should not use floating environment table. And there is no need to do so.
  • To align the tabular and text paragraph side by side: remove (or comment) the empty line above and below the \hfill. LaTeX takes consecutive newlines as \par.
  • Other refinements:
    • Use [t] to vertically align minipage and tabular at the baseline of the first line of their environment contents.
    • Use \firsthline from array package to align by the first row of tabular, not the first \hline.

Full example:

\documentclass{article}
\usepackage{array}

\begin{document}
\begin{figure}[tph]
  \begin{minipage}[t]{0.6\textwidth}%
      \begin{tabular}[t]{|l|l|l|l|}
      \firsthline
      Term       & doc\_1& doc\_2& doc\_3\\ \hline
      largest    & 0.5  & 0.0  & 0.0   \\ \hline
      university & 1.0  & 1.0  & 1.0   \\ \hline
      oldest     & 0.5  & 0.0  & 0.0   \\ \hline
      research   & 0.5  & 0.0  & 0.0   \\ \hline
      1928       & 0.0  & 1.0  & 0.0   \\ \hline
      bjarne     & 0.0  & 0.0  & 1.0   \\ \hline
      founded    & 0.0  & 1.0  & 0.0   \\ \hline
      second     & 0.5  & 0.0  & 0.0   \\ \hline
      denmark    & 0.5  & 1.0  & 0.0   \\ \hline
      stroustrup & 0.0  & 0.0  & 1.0   \\ \hline
      aarhus     & 0.5  & 1.0  & 1.0   \\ \hline
      alumni     & 0.0  & 0.0  & 1.0   \\ \hline
      \end{tabular}
  \end{minipage}
  %
  \hfill
  %
  \begin{minipage}[t]{0.3\textwidth}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod 
  tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, 
  quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo 
  consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse 
  cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat 
  non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
  \end{minipage}
\end{figure}
\end{document}

enter image description here

| improve this answer | |
  • Thanks, I didn't know about the \hfill thingy – Sebastian Nielsen Jun 18 at 21:50

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.