Deutsch English Français Italiano |
<v7do1m$2eh5$1@solani.org> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder8.news.weretis.net!reader5.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Ulrich D i e z <ud.usenetcorrespondence@web.de> Newsgroups: comp.text.tex,de.comp.text.tex Subject: Re: (LaTeX) This doesn't work -- \mbox{ First Line \\ Second Line} Followup-To: comp.text.tex Date: Fri, 19 Jul 2024 15:02:06 +0200 Message-ID: <v7do1m$2eh5$1@solani.org> References: <v7ctni$2rpmu$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Date: Fri, 19 Jul 2024 13:00:38 -0000 (UTC) Injection-Info: solani.org; logging-data="80421"; mail-complaints-to="abuse@news.solani.org" User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 Cancel-Lock: sha1:AJliGQCzU13magbZvbpWLsfmgZU= Content-Language: en-US X-User-ID: eJwFwYEBwCAIA7CXVGhh5yjQ/09YAuNmhRN0CGpdqlaszKjpxKnE5yEYj93257c0YsbGW/MDJ2sRdQ== In-Reply-To: <v7ctni$2rpmu$1@dont-email.me> X-Mozilla-News-Host: news://news.solani.org Bytes: 5651 Lines: 129 [Follow-up to: comp.text.tex] HenHanna wrote: > i want 2 lines to stay together... How do i do it? > > This apparently doesn't work. > > \mbox{ First Line \\ > Second Line} [ de.comp.pdf and de.comp.tex actually are German-language newsgroups. ] \mbox creates a box. TeX switches the typesetting-mode to "restricted horizontal mode" for creating the content of the box. TeX switches the typesetting-mode to "horizontal mode" for placing the created box into the surrounding text. The further typesetting-mode is the typesetting-mode where TeX does no line-breaking at all but creates a box where material is typeset horizontally/from left to right. The latter typesetting-mode is the typesetting-mode where TeX creates paragraphs and hereby breaks text into lines automatically. The circumstance that the content of the box produced by \mbox is typeset in restricted horizontal mode implies that no things are done that concern vertical adjustment as is the case, e.g., with line-breaking. Thus no line-breaking is done with things that are typeset in the typesetting-mode "restricted horizontal mode". Different commands for producing boxes and switching the typesettig-mode when placing them into the document's surrounding text are explained at Tex - LaTeX Stack Exchange - question "What are the different kinds of boxes in (La)TeX?": https://tex.stackexchange.com/a/83936 With your scenario I suggest placing two \hboxes holding single lines of text into \vtop or \vcenter or \vbox. Due to \vtop/\vcenter/\vbox the single \hboxes are typeset in internal vertical mode, i.e. atop each other. The box itself, whose content consists of the two \hboxes that are typeset atop each other, is to be placed into the surrounding text. With \vtop the baseline of the first line/the baseline of the top line of that box itself is aligned with the baseline of the line of the surrounding text which TeX is about to produce. With \vbox the baseline of the last line/the baseline of the bottom line of that box itself is aligned with the baseline of the line of the surrounding text which TeX is about to produce. With \vcenter the vertical center of that box itself is aligned with the math-axis of the line of the surrounding text which TeX is about to produce. (The math axis of a line of text, simplified speaking, is the vertical position where in the line of text in question the bar of a fraction would occur.) Although the box produced by `\vcenter` is typeset in internal vertical mode (where you can use \hbox{...} for having Tex switch to restricted horizontal mode), you need to have TeX to switch to math-mode for placing that box into the line of ttext of the surrounding text. \documentclass {article} \begin{document} Text \fbox{% \vtop{% \hbox{First Line}% \hbox{Second Line}% }% } Text Text \fbox{% $\vcenter{% \hbox{First Line}% \hbox{Second Line}% }$% } Text Text \fbox{% \vbox{% \hbox{First Line}% \hbox{Second Line}% }% } Text \end{document} > ___________________________ > in Comp.Text.Tex ... i only see CTAN (update) announcements > > can i ask LaTeX questions? Yes, of course you can ask questions related to LaTeX at comp.text.tex. The traffic at comp.text.tex has reduced over the years because many people nowadays ask their LaTeX-related questions at TeX - LaTeX Stack Exchange: https://tex.stackexchange.com/ . Many of the regulars of comp.text.tex and many developers of LaTeX packages and members of the LaTeX Project Team also are at TeX - LaTeX Stack Exchange. TeX - LaTeX Stack Exchange in my humble opinion is much more welcoming than other communities of the Stack Exchange netwok. Also the downvoting-policy is different from that of many other communities of the Stack Exchange netwok: At TeX - LaTeX Stack Exchange people are rather reluctant in the matter of downvoting because a harsh downvoting-policy would scare off people unnecessarily. However, TeX - LaTeX Stack Exchange is a question-answer platform and not intended for dialogue while when starting out with LaTeX, you might like to have the opportunity to have dialogues and ask questions that are related to answers you have received. There is a chat at Tex - LaTeX Stack Exchange also, which is sort of separate from the question-answer-thingie, but I think I think comp.text.tex is more suitable for this. Sincerely Ulrich