[Tex/LaTex] How to write two sentences in the same line

horizontal alignment

I want to write this form of sentence,

text1                text2

in the same sentence in the first page of my report. I tried to use flushleft and I right, but I got every text in a different sentence, like this:

text1
                               text2

I used these instructions:

begin{flushleft}
\textbf{text1}
\begin{flushright}
\textbf{text2}
\end{flushright}
\end{flushleft}

How do I fix it?

Best Answer

Like this? (The showframe package is only to show the alignment, just remove it for production run)

The flushleft or flushright environments introduce some vertical spacing each time, this is cause for the two different lines!

Use \hfill for easy cases, or a tabular, for more complicated setups, (i.e. line wrapping etc., which is quite likely if 'sentences' are to be used instead of short words)

\documentclass{article}

\usepackage{showframe}

\begin{document}
\noindent
\textbf{text1}
\hfill
\textbf{text2}

\end{document}

enter image description here

Update, with some wrapping for sentences

\documentclass{article}
\usepackage{tabularx}

\usepackage{ragged2e}
\usepackage{showframe}

\usepackage{array}
\newcolumntype{Y}{>{\RaggedLeft\arraybackslash}X}

\newcommand{\sentenceleftright}[2]{%
  \begin{tabularx}{\textwidth}{@{}X@{}c@{}Y@{}}
    #1 & & #2\\
  \end{tabularx}%
}

\begin{document}
\parindent=0em
\textbf{text1}
\hfill
\textbf{text2}
\sentenceleftright{left}{right}
\sentenceleftright{And now (at last but not least) for something}{really really really really completely different}

\end{document}

enter image description here

Related Question