How can I size the center bar in my LaTeX code for sets with constraints?

In summary: So for example if the rhs was taller, it would scale to match that height instead of the lhs. Overall, scaling it based on the maximum of the two heights would be the best solution.
  • #1
gauss^2
50
0
When I write something in LaTeX, I always try to create shortcuts for things I use a lot, so my code looks has semantically meaningful constructions like \[\CountableUnion{U_n}{n}\] instead of complicated strings of symbols like \[\bigcup_{n=1}^{\infty}U_n\], for example. I have run into a difficulty in trying to create something to express sets with constraints such as the set B_N in the image below:

[PLAIN]http://img401.imageshack.us/img401/6616/screenshot1rg.png

The code I used for that B_N is

Code:
Let us define the countable collection of sets $\CountableCollection{B_N}$ by
\[
   \Defined
      {B_N}
      {\SetWithConstraint
         {
            \SetMember
               {
                  \FiniteSum{a_i x^{n-i}}{i}{0}{n}
               }
               {
                  \Polynomials{\Integers}{x}
               }
         }
         {
             \FiniteSum{\AbsoluteValue{a_i}}{i}{0}{n} \neq 0
             \quad\text{and}\quad n +
             \FiniteSum{\AbsoluteValue{a_i}}{i}{0}{n} = N
        }
     }
\]

where \Defined{a}{b} is translated to a := b and \SetWithContraint{The_set}{The_constraint} is translated to { The_set | The_constraint }. The command \SetWithConstraint is defined in my preamble as:

Code:
\newcommand{\SetWithConstraint}[2]{\left\{\,#1\ \left|\ #2\,\right.\right\}}

My main problem is sizing that center bar | between the set to draw elements from and the constraint the elements must satisfy. As I have it set up right now, its size is determined by the height of the expression in the constraint area (e.g., the expression on the rhs). However, this looks very bad on something like the set K' in the image below, where the expression on the lhs is taller:

[PLAIN]http://img199.imageshack.us/img199/445/screenshottc.png

The relevant code there is

Code:
Hence, we have now shown that $x$ is a limit point of $K$ if and only if
$x = 0$ or there is an integer $m > 0$ with $x = 1/m$. In other words,
\[
   \LimitPoints{K} =
   \Union
      {\Singleton{0}}
      {\SetWithConstraint{\frac{1}{m}}{\SetMember{m}{\PositiveIntegers}}}
\]

where \LimitPoints{K} displays K'. Does anyone know how to size this middle bar | in the \SetWithConstraint command I defined so that it will match the maximum of the height of the expression on the lhs and height of the expression on the rhs? Thanks!
 
Last edited by a moderator:
Physics news on Phys.org
  • #2
Change:
Code:
\newcommand{\SetWithConstraint}[2]{\left\{\,#1\ \left|\ #2\,\right.\right\}}

To:
Code:
\newcommand{\SetWithConstraint}[2]{\left\{\,#1\ \middle|\ #2\,\right\}}
 
  • #3
Thanks NeoDevin; that's exactly what I was looking for. I can't believe that's not included in The Not So Short Introduction to LaTeX2e.
 
  • #4
Very nice NeoDevin!

also a less beautiful result might be, to relate the bar character with lhs by
Code:
\newcommand{\SetWithConstraint}[2]{\left\{\left.\,#1\ \right|\ #2\,\right\}}

Did not try but should work...
 
  • #5
trambolin said:
Very nice NeoDevin!

also a less beautiful result might be, to relate the bar character with lhs by
Code:
\newcommand{\SetWithConstraint}[2]{\left\{\left.\,#1\ \right|\ #2\,\right\}}

Did not try but should work...

That would work to scale it with the lhs, but my understanding was that the OP wanted it to scale with whichever side what taller.
 

Related to How can I size the center bar in my LaTeX code for sets with constraints?

What is LaTeX and how is it related to sizing?

LaTeX is a typesetting system used to create high-quality documents, particularly in the fields of mathematics, science, and engineering. It is related to sizing because it allows for precise control over the size and formatting of text and other elements in a document.

How do I change the font size in LaTeX?

To change the font size in LaTeX, you can use the command "\fontsize{size}{skip}" where "size" is the desired font size and "skip" is the vertical space to be inserted between lines. For example, "\fontsize{12pt}{16pt}\selectfont" will set the font size to 12pt with 16pt between lines.

Is it possible to change the size of specific elements, such as tables or figures, in LaTeX?

Yes, it is possible to change the size of specific elements in LaTeX. For tables, you can use the commands "\small", "\footnotesize", or "\tiny" to decrease the font size. For figures, you can use the "width" or "height" options to adjust the size. For example, "\includegraphics[width=0.5\textwidth]{image.png}" will insert the image at half the width of the page.

How can I adjust the margins and page size in LaTeX?

To adjust the margins and page size in LaTeX, you can use the "geometry" package. This allows you to specify the desired margins and page dimensions using commands such as "\usepackage[left=1in,right=1in,top=1in,bottom=1in]{geometry}". Alternatively, you can use the "geometry" options when creating a new document class.

Can I make my entire document larger or smaller in LaTeX?

Yes, you can adjust the overall size of your document in LaTeX by changing the "documentclass" command. For example, "\documentclass[12pt]{article}" will make the font size and other elements larger compared to "\documentclass[10pt]{article}". However, it is generally recommended to use consistent font sizes throughout your document.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
455
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
3K
Replies
0
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
1K
  • Calculus and Beyond Homework Help
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
Back
Top