
¿Cómo escribir varias líneas en TeX/LaTeX sin cambio de línea? Las líneas no deben estar verticalmente una encima de la otra, pero el resultado debe ser similar al que obtienes cuando escribes una línea con tu máquina de escribir y luego mueves el carro hacia la derecha y luego escribes la siguiente línea sin avance de línea, por lo que que las letras de la segunda línea sobrescriban las letras de la primera línea. Deberías poder poner un marco alrededor de lo que obtienes, como un \fbox
, de modo que el marco esté separado verticalmente tanto en la parte superior del carácter más alto como en la parte inferior del carácter más profundo por \fboxsep
.
Respuesta1
Simplemente puedes configurarlo \baselineskip
en 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}
Respuesta2
Simplemente coloqué las líneas separadas dentro de a tabular
con un marco alrededor de la misma celda. La sobrescritura de líneas se logra con un salto de línea negativo \\[-\normalbaselineskip]
.
\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}