LyXproblem with formula in rotatebox

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Post Reply
Stef Pillaert
Posts: 51
Joined: Sat Oct 22, 2016 3:43 pm

problem with formula in rotatebox

Post by Stef Pillaert »

Hello,
in LyX, I have a very large formula, and I'm trying to rotate is using "rotatebox". I get an error/warning as in "warning.jpg", but strangely enough, the pdf-output looks rather OK.
Also the Lyx-file in attachment, the rotatebox is near to the end of the document.
Any help appreciated a lot,
Stef
Attachments
cursus hyperstatica.lyx
(57.19 KiB) Downloaded 551 times
warning.JPG
warning.JPG (71.72 KiB) Viewed 7261 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

problem with formula in rotatebox

Post by Stefan Kottwitz »

Hi Stef!

There is an error in the code, and LyX seems to hide it. Perhaps post also the pdfLaTeX export here, as attachment, as I don't have LyX here, then I could easily see the cause.

Stefan
LaTeX.org admin
scottkosty
Site Moderator
Posts: 542
Joined: Sat Sep 01, 2012 6:38 am

problem with formula in rotatebox

Post by scottkosty »

I'd be happy to take a look but your document is not a minimal example. Can you please post a minimal example .lyx file? For more information, please read https://wiki.lyx.org/FAQ/MinimalExample
Stef Pillaert
Posts: 51
Joined: Sat Oct 22, 2016 3:43 pm

problem with formula in rotatebox

Post by Stef Pillaert »

OK, I tried to make a minimal example.
I also tried with a scalebox (included in the example also), resulting into similar behaviour: I get similar errormessages, while the pdf-output looks rather OK to me.
I also exported from LyX a LaTeX (pdflatex) and a pdf (pdflatex) file, I hope these are the exprts that you wanted to see?
Please let me know if my info should be in another format, I really use LyX without knowing very much of LaTeX (but you allready guessed that ...)

Thanks,
Stef
Attachments
minimal example rotatebox or scalebox formula.pdf
(86.85 KiB) Downloaded 366 times
minimal example rotatebox or scalebox formula.tex
(3.25 KiB) Downloaded 515 times
minimal example rotatebox or scalebox formula.lyx
(4.88 KiB) Downloaded 425 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

problem with formula in rotatebox

Post by Stefan Kottwitz »

The equation environment needs a box with a width to center within. The rotating box or scaling box doesn't specify a width.

A solution would be, to rotate a box that has a width, such as a parbox or minipage. That can contain the equation. Such as, said in LaTeX code:

Code: Select all

\rotatebox{90}{\parbox{\textheight}{
\begin{equation}
  ...
\end{equation}
}}
That can be adapted to LyX.

Stefan
LaTeX.org admin
Stef Pillaert
Posts: 51
Joined: Sat Oct 22, 2016 3:43 pm

problem with formula in rotatebox

Post by Stef Pillaert »

Many thanks! And indeed, I can do this easily in LyX: just putting the equation in a box, and putting this box into the rotatebox does the trick.
(Should this be considered as a bug in LyX?)
Stef
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

problem with formula in rotatebox

Post by Stefan Kottwitz »

That's not a bug. The same happens in LaTeX. It's just a limitation: \rotatebox uses the width of the inner object (for placement), equation uses the width of the outer object (to center within). One of them needs to have a width, so putting a box of a defined width between them fixes it.

Stefan
LaTeX.org admin
Stef Pillaert
Posts: 51
Joined: Sat Oct 22, 2016 3:43 pm

problem with formula in rotatebox

Post by Stef Pillaert »

OK. Just a small one still: the scalebox suits me best for what I want, but now the number of the equation is printed below the equation, even if there is enough space to print it on the right side of it (see new attrachments). Even if I scale a lot (factor 0.5), this still happens...
Is there an easy way to avoid this?
Stef
Attachments
minimal example rotatebox or scalebox formula.pdf
(85.21 KiB) Downloaded 409 times
minimal example rotatebox or scalebox formula.tex
(2.02 KiB) Downloaded 558 times
minimal example rotatebox or scalebox formula.lyx
(3.69 KiB) Downloaded 498 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

problem with formula in rotatebox

Post by Stefan Kottwitz »

Interesting! And maybe unusual. ;-)

The equation number is place below if the equation is very wide. That happens inside the box, the resizing comes later, outside, via \scalebox. So, a way to get working is
  • making the minipage big enough (the LyX box),
  • compensate by scaling a bit smaller then.

Code: Select all

\scalebox{0.66}{%
\noindent\begin{minipage}[t]{1.4\textwidth}%
\begin{equation}
It's not the common way to use maths in books, so also the fix is a bit unusual.

Stefan
LaTeX.org admin
Stef Pillaert
Posts: 51
Joined: Sat Oct 22, 2016 3:43 pm

problem with formula in rotatebox

Post by Stef Pillaert »

Many thanks for your time, kindness and patience! This works perfectly!
Stef
Post Reply