I'm using the tabular environment in Latex (Overleaf) and would like my text to wrap automatically and be justified. The closest I can get to this is to use the \\
syntax. This is laborious; further, I would like to have justified text, like the rest of my document. I am using a snippet that I found here, but it does not incorporate automatic wrapping and justified text. My minimum working example follows:
\documentclass[11pt,fleqn]{book}
\usepackage{import}
\usepackage{fancyhdr}
\fancyhf{}
\cfoot{\thepage}
\pagestyle{fancy}
\usepackage{soul}
\usepackage[utf8]{inputenc}
\usepackage{subfiles}
%\bibliographystyle{aea}
\usepackage[backend=biber,style=authoryear,sorting=nyvt]{biblatex}
\addbibresource{newbib3.bib}
\begin{document}
\noindent\textbf{Analysis of Editing}\\
\noindent{Substantive}: 0, -2.\\
Further: the, mighty.\\
\begin{tabular}{@{}l@{\ }l}
Value Added: & Yes, I want the benefit of using the tabular environment.\\
& No, because I would like this text to wrap automatically (instead of extending out continuously) and to be justified.
\end{tabular}
\end{document}
Which produces the following:
Analysis of Editing
Substantive: 0, -2.
Further: the, mighty.
Value Added: Yes, I want the benefit of using the tabular environment.
No, because I would like this text to wrap automatically (instead of extending out continuously) and to be justified.
You could either use a column of fixed width, e.g. p{5cm}
or a tabularx
that will automatically adjust the width of the X
columns to fill the desired with.
Unrelated note: please do not abuse \\
for line breaks outside of tables
\documentclass[11pt,fleqn]{book}
\usepackage{import}
\usepackage{fancyhdr}
\fancyhf{}
\cfoot{\thepage}
\pagestyle{fancy}
\usepackage{soul}
\usepackage[utf8]{inputenc}
\usepackage{subfiles}
%\bibliographystyle{aea}
\usepackage[backend=biber,style=authoryear,sorting=nyvt]{biblatex}
\addbibresource{newbib3.bib}
\usepackage{tabularx}
\begin{document}
\noindent\textbf{Analysis of Editing}
\noindent{Substantive}: 0, -2.
Further: the, mighty.
\begin{tabularx}{.953\linewidth}{@{}l@{\ }X}
Value Added: & Yes, I want the benefit of using the tabular environment.\\
& No, because I would like this text to wrap automatically (instead of extending out continuously) and to be justified.
\end{tabularx}
\end{document}