Como escrever várias linhas no TeX sem avanço de linha?

Como escrever várias linhas no TeX sem avanço de linha?

Como escrever várias linhas em TeX/LaTeX sem alimentação de linha? As linhas não devem ficar verticalmente umas sobre as outras, mas o resultado deve ser semelhante ao que você obtém quando digita uma linha com sua máquina de escrever e depois move o carro de volta para a direita e digita a próxima linha sem avançar linha, então que as letras da segunda linha substituam as letras da primeira linha. Você deve ser capaz de colocar um quadro em torno do que obtém - como um \fbox, de modo que o quadro seja separado verticalmente tanto na parte superior do caractere mais alto quanto na parte inferior do caractere mais profundo por \fboxsep.

Responder1

insira a descrição da imagem aqui

Você pode simplesmente definir \baselineskipcomo 0pt

\documentclass{article}

\begin{document}

\begin{center}
  \fbox{\parbox{\dimexpr\textwidth-2\fboxrule-2\fboxsep} {%
      \lineskiplimit=-\maxdimen\baselineskip=0pt\relax
      How to write several lines in
      TeX/LaTeX without line feed? The lines should not lie vertically
      on top of each other, but the result should be similar to what
      you get when you type a line with your typewriter and then move
      carriage back to the right and then type the next line without a
      line feed, so that the letters of the second line overwrite the
      letters of the first line. You should be able to put a frame
      around what you get—like a \texttt{\string\fbox}, so that the
      frame is vertically separated both at the top from the highest
      character and at the bottom from the deepest character by
      \texttt{\string\fboxsep}.}}
\end{center}

\end{document}

Responder2

Acabei de definir as linhas separadas dentro de tabularuma moldura ao redor da mesma célula. A substituição de linhas é obtida com uma quebra de linha negativa \\[-\normalbaselineskip].

1

\documentclass{article}

\begin{document}

\begin{tabular}{| l |}
  \hline
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. \\
  Vestibulum sit amet velit vel elit tincidunt placerat. \\
  Mauris sit amet magna venenatis, malesuada magna eget, venenatis ex. \\
  \hline
\end{tabular}

\bigskip

\begin{tabular}{| l |}
  \hline
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. \\[-\normalbaselineskip]
  Vestibulum sit amet velit vel elit tincidunt placerat. \\[-\normalbaselineskip]
  Mauris sit amet magna venenatis, malesuada magna eget, venenatis ex. \\
  \hline
\end{tabular}

\end{document}

informação relacionada