Efficient Latex Wrapping: Avoiding PDF Overflow | Formula Included

  • LaTeX
  • Thread starter Dustinsfl
  • Start date
  • Tags
    Latex Pdf
In summary: The other option is to split it over two lines, with a \left. on the first and a \right. on the second, I suppose.
  • #1
Dustinsfl
2,281
5
How can I get this to not wrap outside of my pdf

$
\left(-\frac{1}{6 a}(-2 a (-2 + k) + \frac{2\ 2^{1/3} a \left(-3 + a (1 + k)^2\right)}{\left(9 a^2 (-2 + k)-2 a^3 (1 + k)^3 + 3 \sqrt{3} \sqrt{a^3 \left(4 + 4 a^2 (1 + k)^3-a \left(-8 + 20 k + k^2\right)\right)}\right)^{1/3}} + 2^{2/3} \left(9 a^2 (-2 + k)- 2 a^3 (1 + k)^3 + 3 \sqrt{3} \sqrt{a^3 \left(4 + 4 a^2 (1 + k)^3-a \left(-8 + 20 k + k^2\right)\right)}\right)^{1/3}, \frac{p}{a(1 + p)}\right)$
 
Physics news on Phys.org
  • #2
There are multiple ways to do that. The only real trick is that you're probably using \left and \right to control the size of the parentheses at the beginning and end, correct? If so, you can use \right. to "fulfill" a \left(, and you can use a \left. to "fulfill" a \right). In the middle, to break the line, you can either just use multiple double dollar signs, or use a multi-line environment like align.

Example:

Code:
$$\left( stuff \right.$$
$$\left. stuff \right)$$

An aligned environment might work like this:

Code:
\begin{align*}
&\left( stuff \right.\\
&\left. stuff \right)
\end{align*}

So, in your case, the code

Code:
$$\left(-\frac{1}{6 a}(-2 a (-2 + k) + \frac{2\ 2^{1/3} a \left(-3 + a (1 + k)^2\right)}{\left(9 a^2 (-2 + k)-2 a^3 (1 + k)^3 + 3 \sqrt{3} \sqrt{a^3 \left(4 + 4 a^2 (1 + k)^3-a \left(-8

 + 20 k + k^2\right)\right)}\right)^{1/3}}\right.$$

 $$\left.+ 2^{2/3} \left(9 a^2 (-2 + k)- 2 a^3 (1 + k)^3 + 3 \sqrt{3} \sqrt{a^3 \left(4 + 4 a^2 (1 + k)^3-a \left(-8 + 20 k + k^2\right)\right)}

\right)^{1/3}, \frac{p}{a(1 + p)}\right)$$

produces

$$\left(-\frac{1}{6 a}(-2 a (-2 + k) + \frac{2\ 2^{1/3} a \left(-3 + a (1 + k)^2\right)}{\left(9 a^2 (-2 + k)-2 a^3 (1 + k)^3 + 3 \sqrt{3} \sqrt{a^3 \left(4 + 4 a^2 (1 + k)^3-a \left(-8

+ 20 k + k^2\right)\right)}\right)^{1/3}}\right.$$

$$\left.+ 2^{2/3} \left(9 a^2 (-2 + k)- 2 a^3 (1 + k)^3 + 3 \sqrt{3} \sqrt{a^3 \left(4 + 4 a^2 (1 + k)^3-a \left(-8 + 20 k + k^2\right)\right)}

\right)^{1/3}, \frac{p}{a(1 + p)}\right).$$

Not sure how to fix the beginning and ending parentheses differing in size. I would probably write this portion of your paper a little differently, so that I didn't have to display such an ugly equation in one piece.
 
Last edited:
  • #3
Ackbach said:
...

Not sure how to fix the beginning and ending parentheses differing in size. I would probably write this portion of your paper a little differently, so that I didn't have to display such an ugly equation in one piece.

You don't have to use elastic parentheses, you can force their size with \big \Big, \bigg \Bigg :

$$ \Bigg( \Big( \big( ( x^2+y^2 ) \big) \Big) \bigg)\Bigg)$$

You can also pair there by appending l and r for right and left ...

CB
 
Last edited:
  • #4
dwsmith said:
How can I get this to not wrap outside of my pdf

$
\left(-\frac{1}{6 a}(-2 a (-2 + k) + \frac{2\ 2^{1/3} a \left(-3 + a (1 + k)^2\right)}{\left(9 a^2 (-2 + k)-2 a^3 (1 + k)^3 + 3 \sqrt{3} \sqrt{a^3 \left(4 + 4 a^2 (1 + k)^3-a \left(-8 + 20 k + k^2\right)\right)}\right)^{1/3}} + 2^{2/3} \left(9 a^2 (-2 + k)- 2 a^3 (1 + k)^3 + 3 \sqrt{3} \sqrt{a^3 \left(4 + 4 a^2 (1 + k)^3-a \left(-8 + 20 k + k^2\right)\right)}\right)^{1/3}, \frac{p}{a(1 + p)}\right)$

You clould split over multiple lines (recommended) the text as described elsewhere in this thread, or just make it smaller with \small :

$ \small
\left(-\frac{1}{6 a}(-2 a (-2 + k) + \frac{2\ 2^{1/3} a \left(-3 + a (1 + k)^2\right)}{\left(9 a^2 (-2 + k)-2 a^3 (1 + k)^3 + 3 \sqrt{3} \sqrt{a^3 \left(4 + 4 a^2 (1 + k)^3-a \left(-8 + 20 k + k^2\right)\right)}\right)^{1/3}} + 2^{2/3} \left(9 a^2 (-2 + k)- 2 a^3 (1 + k)^3 + 3 \sqrt{3} \sqrt{a^3 \left(4 + 4 a^2 (1 + k)^3-a \left(-8 + 20 k + k^2\right)\right)}\right)^{1/3}, \frac{p}{a(1 + p)}\right)$

CB
 
  • #5
CaptainBlack said:
You don't have to use elastic parentheses, you can force their size with \big \Big, \bigg \Bigg :

$$ \Bigg( \Big( \big( ( x^2+y^2 ) \big) \Big) \bigg)\Bigg)$$

You can also pair there by appending l and r for right and left ...

CB

I tried that with dwsmith's expression, but even \Bigg wasn't big enough to "capture" the rather large depth (top-to-bottom) of it. It looked kinda weird to me.

I have another idea for parenthesis sizing: use a phantom expression. (You can right-click and do Show Source to get the LaTeX code here.)$$\left(-\frac{1}{6 a}(-2 a (-2 + k) + \frac{2\ 2^{1/3} a \left(-3 + a (1 + k)^2\right)}{\left(9 a^2 (-2 + k)-2 a^3 (1 + k)^3 + 3 \sqrt{3} \sqrt{a^3 \left(4 + 4 a^2 (1 + k)^3-a \left(-8

+ 20 k + k^2\right)\right)}\right)^{1/3}}\right.$$

$$\left.\phantom{\frac{1^{1/3}}{\sqrt{\left(1^{2}\right)^{2}}^{1/3}}}+ 2^{2/3} \left(9 a^2 (-2 + k)- 2 a^3 (1 + k)^3 + 3 \sqrt{3} \sqrt{a^3 \left(4 + 4 a^2 (1 + k)^3-a \left(-8 + 20 k + k^2\right)\right)}

\right)^{1/3}, \frac{p}{a(1 + p)}\right)$$

I chose the phantom expression to match the first line's greatest depth in as little width as possible. Here's the phantom expression:

Code:
\phantom{\frac{1^{1/3}}{\sqrt{\left(1^{2}\right)^{2}}^{1/3}}}.

If I didn't wrap the phantom expression around it, I'd get

$$\frac{1^{1/3}}{\sqrt{\left(1^{2}\right)^{2}}^{1/3}}.$$
 
  • #6
Ackbach said:
I tried that with dwsmith's expression, but even \Bigg wasn't big enough to "capture" the rather large depth (top-to-bottom) of it. It looked kinda weird to me.

I have another idea for parenthesis sizing: use a phantom expression. (You can right-click and do Show Source to get the LaTeX code here.)$$\left(-\frac{1}{6 a}(-2 a (-2 + k) + \frac{2\ 2^{1/3} a \left(-3 + a (1 + k)^2\right)}{\left(9 a^2 (-2 + k)-2 a^3 (1 + k)^3 + 3 \sqrt{3} \sqrt{a^3 \left(4 + 4 a^2 (1 + k)^3-a \left(-8

+ 20 k + k^2\right)\right)}\right)^{1/3}}\right.$$

$$\left.\phantom{\frac{1^{1/3}}{\sqrt{\left(1^{2}\right)^{2}}^{1/3}}}+ 2^{2/3} \left(9 a^2 (-2 + k)- 2 a^3 (1 + k)^3 + 3 \sqrt{3} \sqrt{a^3 \left(4 + 4 a^2 (1 + k)^3-a \left(-8 + 20 k + k^2\right)\right)}

\right)^{1/3}, \frac{p}{a(1 + p)}\right)$$

I chose the phantom expression to match the first line's greatest depth in as little width as possible. Here's the phantom expression:

Code:
\phantom{\frac{1^{1/3}}{\sqrt{\left(1^{2}\right)^{2}}^{1/3}}}.

If I didn't wrap the phantom expression around it, I'd get

$$\frac{1^{1/3}}{\sqrt{\left(1^{2}\right)^{2}}^{1/3}}.$$
To my eye, nearly all of those parentheses look too big. I would avoid the indiscriminate use of \left and \right, and write the first of those two lines as
$$\left(-\frac{1}{6 a}(-2 a (-2 + k) + \frac{2\ 2^{1/3} a \bigl(-3 + a (1 + k)^2\bigr)}{\Bigl(9 a^2 (-2 + k)-2 a^3 (1 + k)^3 + 3 \sqrt{3} \sqrt{a^3 \bigl(4 + 4 a^2 (1 + k)^3-a (-8 + 20 k + k^2)\bigr)}\Bigr)^{1/3}}\right.$$
with something similar (including a \phantom to get the correct size of the final closing parenthesis correct) for the second line.
 
  • #7
Opalg said:
To my eye, nearly all of those parentheses look too big. I would avoid the indiscriminate use of \left and \right, and write the first of those two lines as
$$\left(-\frac{1}{6 a}(-2 a (-2 + k) + \frac{2\ 2^{1/3} a \bigl(-3 + a (1 + k)^2\bigr)}{\Bigl(9 a^2 (-2 + k)-2 a^3 (1 + k)^3 + 3 \sqrt{3} \sqrt{a^3 \bigl(4 + 4 a^2 (1 + k)^3-a (-8 + 20 k + k^2)\bigr)}\Bigr)^{1/3}}\right.$$
with something similar (including a \phantom to get the correct size of the final closing parenthesis correct) for the second line.

Nice! Perhaps even another improvement would be to move one of the parentheses in the denominator to the right a little, and maybe move the 1/3 exponent in a little. I would also definitely insert a cdot in the numerator to indicate a multiplication (otherwise it might look like the number 22). Or you could just combine the exponents. Result:

$$\left(-\frac{1}{6 a}(-2 a (-2 + k) + \frac{2^{4/3} a \bigl(-3 + a (1 + k)^2\bigr)}{\Bigl(9 a^2 (-2 + k)-2 a^3 (1 + k)^3 + 3 \sqrt{3} \sqrt{a^3 \bigl(4 + 4 a^2 (1 + k)^3-a (-8 + 20 k + k^2)\bigr)}\;\:\Bigr)^{\!\!1/3}}\right.$$

This has to be a Mathematica result, right dwsmith?
 

FAQ: Efficient Latex Wrapping: Avoiding PDF Overflow | Formula Included

1. How do I convert a PDF into a Latex document?

There are several ways to convert a PDF into a Latex document, depending on the tools and software you have available. One option is to use a PDF to Latex converter, such as GrindEQ or PDF2Latex. Alternatively, you can use Adobe Acrobat to export the PDF as a Latex file. Some Latex editors, such as Overleaf, also have the option to import a PDF and convert it into a Latex document.

2. What is the purpose of wrapping Latex in a PDF?

Latex wrapping in a PDF allows you to create a portable, self-contained document that can be easily shared and viewed on any device without the need for specialized software or fonts. This is especially useful for academic papers or articles that need to be submitted to journals or conferences.

3. Can I edit a Latex-wrapped PDF?

Yes, you can edit a Latex-wrapped PDF, but it requires specialized software and knowledge of Latex. The best approach is to edit the original Latex document and then recompile it into a new PDF. Alternatively, some PDF editors, such as Adobe Acrobat, have limited functionality for editing Latex equations directly.

4. How can I ensure the quality of a Latex-wrapped PDF?

To ensure the quality of a Latex-wrapped PDF, it is important to carefully check the PDF after it has been converted from Latex. This includes checking for any formatting errors, missing equations or symbols, and overall consistency. It is also recommended to use high-quality Latex templates and fonts to avoid any potential issues with the conversion process.

5. Are there any limitations to Latex wrapping in a PDF?

One potential limitation of Latex wrapping in a PDF is the lack of interactivity and dynamic elements. While Latex allows for complex equations and formatting, it is not designed for interactive features such as hyperlinks or animations. Additionally, not all Latex features may be supported in the PDF format, so it is important to carefully test and check the resulting PDF for any potential issues.

Back
Top