fboxes

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

fboxes

Nitecki, Zbigniew H.
I am generating a two-column document, and want to box in the statement of a theorem.
If in one line, it runs across the two columns.  So I put it in a \parbox, and broke it into two lines.  

My question is this:
(see attached example) if I set the width as either \linewidth or \columnwidth, the box 
(and hence the frame) runs to the end of the column line.  This makes sense, but it leaves
a lot of space to the right of the text in the box. 
Is there a way to make the box fit the width of the text, rather than the predefined line or column width?
I don’t want to use rigid lengths (eg 4in) because the pdf that I generate will go through an ExplainEverything
recording, and I am not sure what the final dimensions of anything will be—I prefer to have that controlled
internally.


Zbigniew Nitecki
Department of Mathematics
Tufts University
Medford, MA 02155

telephones:
Office    (617)627-3843
Dept.    (617)627-3234
Dept. fax    (617)627-3966
http://www.tufts.edu/~znitecki/





----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex

EGtest.tex (846 bytes) Download Attachment
EGtest.pdf (10K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: fboxes

Murray Eisenberg
It’s unclear whether you want to size all the parboxes to the same width. If so, the following will do it.
(If you want each parbox’s width sized separately, the solution is even simpler.) I’m including some blind text so you can actually see the columns!

\documentclass[11pt,twocolumn]{article}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{enumerate}
\usepackage[margin=0.5in, landscape, paperwidth=4.5in, paperheight=8in]{geometry}

\setlength{\columnsep}{3em}

\newcommand{\mathbox}[1]{\fbox{\ensuremath{#1}}}

\usepackage{calc}

\usepackage[math]{blindtext}

\begin{document}

\Blindtext[1]

\newcommand{\firsthyp}{Theorem: If $x_{k}\to x$ and $y_{k}\to y$,}
\newcommand{\firstconcl}{then $z_{k}=(x_{k}+y_{k})\to z=(x+y)$}
\newcommand{\secondhyp}{Theorem: If $x_{k}\to x$ and $y_{k}\to y$,}
\newcommand{\secondconcl}{then $z_{k}=(x_{k}+y_{k})\to z=(x+y)$}
\newcommand{\thmonewidth}{\maxof{\widthof{\firsthyp}}{\widthof{\firstconcl}}}
\newcommand{\thmtwowidth}{\maxof{\widthof{\secondhyp}}{\widthof{\secondconcl}}}
\newcommand{\thmswidth}{\maxof{\thmonewidth}{\thmtwowidth}}

\begin{flushleft}
\fbox{\parbox{\thmswidth}{\firsthyp\\
\firstconcl}}
\fbox{\parbox{\thmswidth}{\secondhyp\\
\secondconcl}}
\end{flushleft}

\Blindtext[2]

\end{document}


On 16 Jul2020, at 4:29 PM, Nitecki, Zbigniew H. <[hidden email]> wrote:

I am generating a two-column document, and want to box in the statement of a theorem.
If in one line, it runs across the two columns.  So I put it in a \parbox, and broke it into two lines.  

My question is this:
(see attached example) if I set the width as either \linewidth or \columnwidth, the box 
(and hence the frame) runs to the end of the column line.  This makes sense, but it leaves
a lot of space to the right of the text in the box. 
Is there a way to make the box fit the width of the text, rather than the predefined line or column width?
I don’t want to use rigid lengths (eg 4in) because the pdf that I generate will go through an ExplainEverything
recording, and I am not sure what the final dimensions of anything will be—I prefer to have that controlled
internally.


Zbigniew Nitecki
Department of Mathematics
Tufts University
Medford, MA 02155

telephones:
Office    (617)627-3843
Dept.    (617)627-3234
Dept. fax    (617)627-3966
http://www.tufts.edu/~znitecki/




<EGtest.tex><EGtest.pdf>----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
               https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex

---
Murray Eisenberg [hidden email]
503 King Farm Blvd #101 Home (240)-246-7240
Rockville, MD 20850-6667 Mobile (413)-427-5334



----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex
Reply | Threaded
Open this post in threaded view
|

Re: fboxes

Murray Eisenberg
I should add that the brute-force boxing in your original example (and my verbose method to do what I think you’re asking) seem awkward ways to accomplish boxing.

How about trying, say, the mdframed package? Or if all theorems are going to be similarly framed, then the ntheorem package with its framed option. Or the tcolorbox package. Or the thmtools package and then use a \declaretheorem with one of its options being shaded={rulecolor=black, bgcolor=white}?

On 16 Jul2020, at 5:15 PM, Murray Eisenberg <[hidden email]> wrote:

It’s unclear whether you want to size all the parboxes to the same width. If so, the following will do it.
(If you want each parbox’s width sized separately, the solution is even simpler.) I’m including some blind text so you can actually see the columns!

\documentclass[11pt,twocolumn]{article}
\usepackage{amsmath,amssymb,amsthm}
\usepackage{enumerate}
\usepackage[margin=0.5in, landscape, paperwidth=4.5in, paperheight=8in]{geometry}

\setlength{\columnsep}{3em}

\newcommand{\mathbox}[1]{\fbox{\ensuremath{#1}}}

\usepackage{calc}

\usepackage[math]{blindtext}

\begin{document}

\Blindtext[1]

\newcommand{\firsthyp}{Theorem: If $x_{k}\to x$ and $y_{k}\to y$,}
\newcommand{\firstconcl}{then $z_{k}=(x_{k}+y_{k})\to z=(x+y)$}
\newcommand{\secondhyp}{Theorem: If $x_{k}\to x$ and $y_{k}\to y$,}
\newcommand{\secondconcl}{then $z_{k}=(x_{k}+y_{k})\to z=(x+y)$}
\newcommand{\thmonewidth}{\maxof{\widthof{\firsthyp}}{\widthof{\firstconcl}}}
\newcommand{\thmtwowidth}{\maxof{\widthof{\secondhyp}}{\widthof{\secondconcl}}}
\newcommand{\thmswidth}{\maxof{\thmonewidth}{\thmtwowidth}}

\begin{flushleft}
\fbox{\parbox{\thmswidth}{\firsthyp\\
\firstconcl}}
\fbox{\parbox{\thmswidth}{\secondhyp\\
\secondconcl}}
\end{flushleft}

\Blindtext[2]

\end{document}


On 16 Jul2020, at 4:29 PM, Nitecki, Zbigniew H. <[hidden email]> wrote:

I am generating a two-column document, and want to box in the statement of a theorem.
If in one line, it runs across the two columns.  So I put it in a \parbox, and broke it into two lines.  

My question is this:
(see attached example) if I set the width as either \linewidth or \columnwidth, the box 
(and hence the frame) runs to the end of the column line.  This makes sense, but it leaves
a lot of space to the right of the text in the box. 
Is there a way to make the box fit the width of the text, rather than the predefined line or column width?
I don’t want to use rigid lengths (eg 4in) because the pdf that I generate will go through an ExplainEverything
recording, and I am not sure what the final dimensions of anything will be—I prefer to have that controlled
internally.


Zbigniew Nitecki
Department of Mathematics
Tufts University
Medford, MA 02155

telephones:
Office    (617)627-3843
Dept.    (617)627-3234
Dept. fax    (617)627-3966
http://www.tufts.edu/~znitecki/




<EGtest.tex><EGtest.pdf>----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
               https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex

---
Murray Eisenberg [hidden email]
503 King Farm Blvd #101 Home (240)-246-7240
Rockville, MD 20850-6667 Mobile (413)-427-5334



---
Murray Eisenberg [hidden email]
503 King Farm Blvd #101 Home (240)-246-7240
Rockville, MD 20850-6667 Mobile (413)-427-5334



----------- Please Consult the Following Before Posting -----------
TeX FAQ: http://www.tex.ac.uk/faq
List Reminders and Etiquette: https://sites.esm.psu.edu/~gray/tex/
List Archives: http://dir.gmane.org/gmane.comp.tex.macosx
                https://email.esm.psu.edu/pipermail/macosx-tex/
TeX on Mac OS X Website: http://mactex-wiki.tug.org/
List Info: https://email.esm.psu.edu/mailman/listinfo/macosx-tex