Text von Zeilen trennen

Text von Zeilen trennen

Ich benutze

\documentclass[10pt]{article}

\begin{document}

\arrayrulewidth=0.7pt
\begin{tabular}{|c|c|l|c|c|c|l|}
\cline{1-3}\cline{5-7}
 &  & fun &  &  &  & first sight \\
1 & for & nothing &  & 5 & at & university \\
 &  & a chance &  &  &  & expense \\
\cline{1-3}\cline{5-7}
 &  & chance &  &  &  & control \\
2 & by & mistake &  & 6 & under & (her) breath \\
 &  & accident &  &  &  & investigation \\
\cline{1-3}\cline{5-7}
 &  & holiday &  &  &  & touch \\
3 & on & business &  & 7 & out of & luck \\
 &  & a diet &  &  &  & work \\
\cline{1-3}\cline{5-7}
 &  & trouble &  &  &  & A to Z \\
4 & in & a mess &  & 8 & from & scratch \\
 &  & the end &  &  &  & memory \\
\cline{1-3}\cline{5-7}
\end{tabular}

\end{document}

Das Ergebnis:

Bildbeschreibung hier eingeben

In der dritten Spalte stehen die ersten Wörter sehr nah an den Zeilen. Gibt es eine Möglichkeit, diese Wörter ein wenig von den Zeilen abzuheben?

Antwort1

URSPRÜNGLICHE LÖSUNG:

Es ist weder schön noch automatisch, aber hier füge ich mit einen 3pt-Puffer (über und unter) dem obersten Wort in jeder Zeile hinzu \addstackgap.

\documentclass[10pt]{article}
\usepackage{stackengine}
\setstackgap{S}{3pt}
\begin{document}

\arrayrulewidth=0.7pt
\begin{tabular}{|c|c|l|c|c|c|l|}
\cline{1-3}\cline{5-7}
 &  &  \addstackgap{fun} &  &  &  & first sight \\
1 & for & nothing &  & 5 & at & university \\
 &  & a chance &  &  &  & expense \\
\cline{1-3}\cline{5-7}
 &  & \addstackgap{chance} &  &  &  & control \\
2 & by & mistake &  & 6 & under & (her) breath \\
 &  & accident &  &  &  & investigation \\
\cline{1-3}\cline{5-7}
 &  & \addstackgap{holiday} &  &  &  & touch \\
3 & on & business &  & 7 & out of & luck \\
 &  & a diet &  &  &  & work \\
\cline{1-3}\cline{5-7}
 &  & \addstackgap{trouble} &  &  &  & A to Z \\
4 & in & a mess &  & 8 & from & scratch \\
 &  & the end &  &  &  & memory \\
\cline{1-3}\cline{5-7}
\end{tabular}

\end{document}

Bildbeschreibung hier eingeben

ALTERNATIVER ANSATZ

Eine alternative Lösung, um die Notwendigkeit zu vermeiden, die Daten jeder Zeile ändern zu müssen: Fügen Sie der Spaltendefinition eine benutzerdefinierte Strebe hinzu.

\documentclass[10pt]{article}
\def\mystrut{\rule{0pt}{10pt}}
\begin{document}

\arrayrulewidth=0.7pt
\begin{tabular}{@{\mystrut}|c|c|l|c|c|c|l|}
\cline{1-3}\cline{5-7}
 &  &   fun &  &  &  & first sight \\
1 & for & nothing &  & 5 & at & university \\
 &  & a chance &  &  &  & expense \\
\cline{1-3}\cline{5-7}
 &  & chance &  &  &  & control \\
2 & by & mistake &  & 6 & under & (her) breath \\
 &  & accident &  &  &  & investigation \\
\cline{1-3}\cline{5-7}
 &  & holiday &  &  &  & touch \\
3 & on & business &  & 7 & out of & luck \\
 &  & a diet &  &  &  & work \\
\cline{1-3}\cline{5-7}
 &  & trouble &  &  &  & A to Z \\
4 & in & a mess &  & 8 & from & scratch \\
 &  & the end &  &  &  & memory \\
\cline{1-3}\cline{5-7}
\end{tabular}

\end{document}

Bildbeschreibung hier eingeben

Antwort2

\extrarowheightAus der Verpackung verwenden array.

Während das Auge den Abstand der unteren Wörter zur Linie misst, indem es auf die Grundlinie schaut, schauen wir nach oben auf die Oberlängen. Mit ein paar einfachen geometrischen Berechnungen können wir die erforderliche zusätzliche Höhe berechnen.

\documentclass[10pt]{article}
\usepackage{array}

\begin{document}

\begin{center}
\setlength{\arrayrulewidth}{0.7pt}
\setlength{\extrarowheight}{%
  \dimexpr\dp\strutbox-\ht\strutbox+\fontcharht\font`A
}

\begin{tabular}{|c|c|l|c|c|c|l|}
\cline{1-3}\cline{5-7}
  &     & fun      &&   &        & first sight \\
1 & for & nothing  && 5 & at     & university \\
  &     & a chance &&   &        & expense \\
\cline{1-3}\cline{5-7}
  &     & chance   &&   &        & control \\
2 & by  & mistake  && 6 & under  & (her) breath \\
  &     & accident &&   &        & investigation \\
\cline{1-3}\cline{5-7}
  &     & holiday  &&   &        & touch \\
3 & on  & business && 7 & out of & luck \\
  &     & a diet   &&   &        & work \\
\cline{1-3}\cline{5-7}
  &     & trouble  &&   &        & A to Z \\
4 & in  & a mess   && 8 & from   & scratch \\
  &     & the end  &&   &        & memory \\
\cline{1-3}\cline{5-7}
\end{tabular}

\end{center}

\end{document}

Bildbeschreibung hier eingeben

Hier ist eine andere Erkenntnis:

\documentclass[10pt]{article}
\usepackage{booktabs}

\begin{document}

\begin{center}

\begin{tabular}{llcll}
\cmidrule[\heavyrulewidth]{1-2}\cmidrule[\heavyrulewidth]{4-5}
1. \textit{for} & fun      && 5. \textit{at}     & first sight \\
                & nothing  &&                    & university \\
                & a chance &&                    & expense \\
\cmidrule[\heavyrulewidth]{1-2}\cmidrule[\heavyrulewidth]{4-5}
2. \textit{by}  & chance   && 6. \textit{under}  & control \\
                & mistake  &&                    & (her) breath \\
                & accident &&                    & investigation \\
\cmidrule[\heavyrulewidth]{1-2}\cmidrule[\heavyrulewidth]{4-5}
3. \textit{on}  & holiday  && 7. \textit{out of} & touch \\
                & business &&                    & luck \\
                & a diet   &&                    & work \\
\cmidrule[\heavyrulewidth]{1-2}\cmidrule[\heavyrulewidth]{4-5}
4. \textit{in}  & trouble  && 8. \textit{from}   & A to Z \\
                & a mess   &&                    & scratch \\
                & the end  &&                    & memory \\
\cmidrule[\heavyrulewidth]{1-2}\cmidrule[\heavyrulewidth]{4-5}
\end{tabular}

\end{center}

\end{document}

Bildbeschreibung hier eingeben

Antwort3

Legen Sie eine Form von fest \minrowclearance{<len>}, die den Abstand zwischen dem Zellinhalt und den horizontalen Linien auf mindestens vergrößert <len>:

Bildbeschreibung hier eingeben

\documentclass{article}

\usepackage{colortbl}
\setlength{\minrowclearance}{5pt}

\begin{document}

\setlength{\arrayrulewidth}{0.7pt}

\begin{tabular}{|c|c|l|c|c|c|l|}
  \cline{1-3}\cline{5-7}
    &     & fun      &  &   &        & first sight \\
  1 & for & nothing  &  & 5 & at     & university \\
    &     & a chance &  &   &        & expense \\
  \cline{1-3}\cline{5-7}
    &     & chance   &  &   &        & control \\
  2 & by  & mistake  &  & 6 & under  & (her) breath \\
    &     & accident &  &   &        & investigation \\
  \cline{1-3}\cline{5-7}
    &     & holiday  &  &   &        & touch \\
  3 & on  & business &  & 7 & out of & luck \\
    &     & a diet   &  &   &        & work \\
  \cline{1-3}\cline{5-7}
    &     & trouble  &  &   &        & A to Z \\
  4 & in  & a mess   &  & 8 & from   & scratch \\
    &     & the end  &  &   &        & memory \\
  \cline{1-3}\cline{5-7}
\end{tabular}

\end{document}

verwandte Informationen