I would like to create a series of containers in the same size but with different contents, making such that the contained text reduces its font size if it would not fit the container otherwise.  Is there any way to automatically reduce font size to avoid overflowing of the container?  This question is a duplicate of .
123713
I would like to fit text (potentially several paragraphs) into a box of given size. This should be done by adjusting the fontsize of the contained text.  Clarification edit: The given dimensions are the maximum space the result should occupy. There is no need to fill the box fully, but under no circumstances should the dimensions be exceeded.  Something like  \fitbox{&lt;width&gt;}{&lt;height}{Some text to be squeezed into a box \par With paragraphs}   or  \begin{fitbox}{&lt;width&gt;}{&lt;height&gt;} Some text to be squeezed into a box  With paragraphs \end{fitbox}   There are a number of questions here that ask the same in the title, but then only target to constrain the width or the height. I want to constrain both. Also, I would like the text only the be adjusted in the fontsize, not scaled disproportionally in one direction.  @TH solves this for another question by fitting text on a page. Unfortunately, my TeX knowledge is too limited to adapt that to a box. See here:  For a page-fitting, his solution looks great to me. Maybe that's a starting point.    Edit: comparing the solutions from Werner and Martin  I've used XeLaTeX from TeXLive 2011 to compare the solutions from Werner and Martin below. The font is a TrueType Times New Roman vector font. The fitboxes are contained in a framebox to help comparison.  Case 1 is a box of 2cm x 2cm. Case 2 is the same text in a box of 8cm x 2cm.    Both boxes can be stacked next to each other horizontally and only consume the space they should. However, in Case 1 the box with Martin's approach is too high, while Werner's box fits the content correctly.    Edit 2: some more tests show: both suggestions can fail  After some more tests, the case illustrated below fails for both suggestions from Werner and Martin. That means, the question is still open.    As Werner points out in a comment to his answer, the reason is that TeX cannot hyphenate the pattern. At the same time, it finds it acceptable to set it into the box and run over the edge.  After some research I believe that the algorithm after each line would have to check for \badness and if that exceeds 10000 reduce the font size further. At least the  points in that direction.  Has anyone the insights and experience to put these pieces and the excellent work from Werner and Martin together into something that works and really stays inside the given box?    Edit 3: Another idea that might help to solve this  Another approach that might help would be a way to measure the width of the longest word (or box) of the paragraph, let's say it is wl. The associated font size is f. The maximum desired box width as given by the user is wmax.  Then, the upper bound for the font size could be calculated by     fmax = f * wmax / wl   This, of course, assumes that everything works out proportionally, which probably isn't entirely true considering inter word and inter character spacing. But it should be sufficiently good to keep the text in the fitbox horizontally.  Since this can only shrink the fontsize (it's an upper bound), the vertical condition if met before would still be met afterwards. That means, this could be applied after the suggestion of @Werner as a check and adjustment if required.  Does anyone have the TeX experience to stick that in?
91219
Based on this question,  and its comments and answers, I did some research, but I didn't find a complete answer.   For me it is obvious that it is a good decision to limit the width of the main container, but what is the recommended max-width for the main container for large screens, in 2017, when the screens become larger and larger? What variables should be considered in this decision?  Also, let's say a website has multiple columns in the main container, what is the max-width for the main column?  Update: I have now a related question. I recommended to one client to reduce the width of the main container on the homepage, but I can't convince him. It is a website with photos, like pexels.com. It is in this case important to limit the width if the elements are not one more important than other?
16232
For complex length manipulation (see ), I would need to get the font size that was passed as an option to the document class:  \documentclass[12pt]{article} \newlength{\mainfontsize} \setlength{\mainfontsize}{\@ptsize}   I would like it to work on all the main classes including beamer and extarticle. Currently this fails on beamer. How to make it work? (and I don't want the exact size of the font like 10.95pt for 11pt, I want the option that was passed).
35977
Does anybody know of a documentclass that produces a page that has a fixed width and a variable length, depending on the actual content that needs to fit on the sheet? I'm trying to get something like a kind of scroll if possible.
31452
I want to make a figure composed of two images that have different sizes. I want to put them side by side so that they have the same height and that they overall take, say, 90% of the line width.  It is easy to make them have the same fixed height (say in cm), but how to let this common height be automatically adjusted to fulfill the desired overall width? Manual trial-and-error is time-consuming, approximate and non robust.  A solution with or without subfigure or another LaTeX package is OK.
99716
I often have very limited space when creating reports and dashboards for users. I usually use Arial, or Arial Narrow, but UI isn't my area of expertise, so I want to know, how do you determine an optimal font for fitting the most readable text in the smallest space?  Here is an example: Keep in mind this is just an example, as there are many times that space is limited, such as when you need to squeeze a million columns into a report, etc.
107893
I m importing one image in latex document. But caption has bigger font than my normal text on page.   \documentclass{article} \usepackage{graphicx}  \begin{document}    Some text...    \begin{figure}[htb]   \begin{center}   \includegraphics[height=1in,width=1in,angle=-90]{foo}   \caption{This is a figure.}   \end{center}   \end{figure}     More text...    \end{document}   How to reduce the font size of caption and space between caption and image?
48864
I have to submit a manuscript to a journal, and I just realized that they want every single part of the paper to be in 12 pt font. This includes tables text, footnotes, acknowledgements etc. Is there a way to force all text to be the same size?
13319
I have made many figures with tikz and want to include them in a template. Unfortunately I used ex as a measure and the template I have to use redefines the font size. THis leads to wrong distances in the figures. is there a way to set the font size for all tikz figures in a document, so I do not have to adjust my figures?
7058
I am creating a custom WPF control that let's say for simplicity sake has a vertical stack panel with a "title" TextBlock, followed by a ContentPresenter. I want the font size for the "title" to be 5 Points LARGER than the size used in the content, which is inherited by whatever container the user places this control in.  How can I specify a font size in the control template for the header element using a relative value without exposing a property like "TitleFontSize" to the user? I want do "add 5".  I tried using a ScaleTransform on the header text block with mixed results (the text block scaled fine but the orientation was modified - I had the text right-justified and it moved "off the control" area when scaled). Also, I am not sure if scale transform would be approprite here.
98228
I've written an exam paper for my students, using the  class with fairly standard options, and specifically using the 12pt class option for 12 point type. I've just been informed that a student has vision problems that require an 18pt main font. What is a good way to achieve this? Some things that might be of impact:   I don't make much use of smaller fonts (e.g., \small, etc.) but redefining just normalsize would not be sufficient since question headings, etc., use a larger size (mostly \large). Probably the cover page could remain the original size - it's the main question text that really matters Something a bit more that 18pt would be fine I do not want to switch classes, as my existing source depends upon the exam class I have been asked to keep to the original A4 page size, rather than scaling everything up to a larger page, because exam desks have limited size.
21533
Here are two examples of what I mean:   I am sure you all too have experienced this frustration before. A dialog box opens that displays only part of a long string (e.g. a file path), but won't allow you to select the text so you can read the full string. Neither text container will resize upon window resizing. (By the way, you can force windows —specially dialog boxes— to resize with tools such as , but helps little in this case, since controls are fixed-width.) The text is hidden, period. Copying a very long drop-down list control contents to a text file.   Do you know any way to solve these problems?
44376
I wanted to amplify the effect of specifying the font size. So I tried: {\tiny\tiny Super tiny text!} But that doesn't seem to work. I needed suggestions to achieve the same goal.
78564
I have a group of equations, such as  /begin{gather} Eq1 // Eq2 // Eq3 // Eq4 /end{gather}   Unfortunately, some of the equations in the group are too long to fit on the page.  For equations that are only slightly too long, is there a way to slightly decrease the font size of that equation only?  For equations that are much too long, is there any automated way to split the equation (where the computer decides where and how to split it to fit the page width), or would this split need to be defined by the user?  Thank you, Kevin  P.S.  Here is my code where the matrix is too wide and goes off the end of the page:  \documentclass{article} \begin{document} \[ \mathbf{L} = \left[ \begin{array}{*{6}{c}} {{L_S}}&amp;{ - {L_{SS}}}&amp;{ - {L_{SS}}}&amp;{M\cos \theta }&amp;{M\cos \left( {\theta  +       \frac{{2\pi }}{3}} \right)}&amp;{M\cos \left( {\theta  - \frac{{2\pi }}{3}}   \right)}\\ { - {L_{SS}}}&amp;{{L_S}}&amp;{ - {L_{SS}}}&amp;{M\cos \left( {\theta  - \frac{{2\pi }}{3}} \right)}&amp;{M\cos \theta }&amp;{M\cos \left( {\theta  + \frac{{2\pi }}{3}} \right)}\\ { - {L_{SS}}}&amp;{ - {L_{SS}}}&amp;{{L_S}}&amp;{M\cos \left( {\theta  + \frac{{2\pi }}{3}} \right)}&amp;{M\cos \left( {\theta  - \frac{{2\pi }}{3}} \right)}&amp;{M\cos \theta }\\ {M\cos \theta }&amp;{M\cos \left( {\theta  - \frac{{2\pi }}{3}} \right)}&amp;{M\cos \left( {\theta  + \frac{{2\pi }}{3}} \right)}&amp;{{L_R}}&amp;{ - {L_{RR}}}&amp;{ - {L_{RR}}}\\ {M\cos \left( {{\theta} + \frac{{2\pi }}{3}} \right)}&amp;{M\cos \theta }&amp;{M\cos \left( {\theta  - \frac{{2\pi }}{3}} \right)}&amp;{ - {L_{RR}}}&amp;{{L_R}}&amp;{ -     {L_{RR}}}\\ {M\cos \left( {{\theta _2} - \frac{{2\pi }}{3}} \right)}&amp;{M\cos \left( {{\theta _2} + \frac{{2\pi }}{3}} \right)}&amp;{M\cos \theta }&amp;{ - {L_{RR}}}&amp;{ - {L_{RR}}}&amp;{{L_R}} \end{array}\right] \] \end{document}
58280
I'm trying to center a fixed size control within a form.  Out of interest, is there a non-idiotic way of doing this? What I really want is something analogous to the text-align css property.  At the moment, I'm setting the padding property of the surrounding form to a suitable size and setting the Dock property of the control to fill.
37843
I would like to make a very compact list (e.g., itemize) in Beamer.  has been asked for an article-type document class; the answer uses the enumitem package, known to be .  My question is: How do I make the same compact list in the Beamer document class? As in the above linked question, I would like the list to have   No whitespace before list No whitespace after list No whitespace between lines Less indent before the bullet points
6523
I am trying to achieve a table where a few things have to work simultaneously. Several of these things have been discussed before, but I have been unable to make everything work at once (and some things at all).  I want to be able to use different font sizes in cells on the same row, and have them precisely aligned at the top. That has almost been achieved in the MWE below, but the letters of the smaller font are slightly below the letters of the larger font. (Previous discussion: , but the alignment is only close, not perfect.)  Edit: The top alignment should be for the maximum height of the font used, so that an 'a' ends up at the same height whether it is written by itself or followed by a tall letter, such as an 'l' (or, if the small 'b' next to the big 'B' in the example below is changed for a small 'a', the 'a' should not jump up to the ceiling.  I also want to be able to insert several rows of text with forced line breaks within a cell of the table, and those rows need to have the same spacing between them as normal text has. That has been achieved by nesting another table in a cell in the MWE below.  In addition, I want to be able to use \hfill to put something out in the right margin from within the nested table, which works in the MWE.  Further, the margins on the top, bottom and sides of the table should be zero, so that only the page margins determine the amount of white space around the table (as it is now, there is even a difference between the right and left margins -- although the margins were for some reason adjusted when I uploaded the pdf below, it is visible if you compile the code and look at the pdf directly).  Lastly, I would like to get rid of all automatic spacing between cells, and then define my own spacing. Preferably, I would like to be able to define the vertical spacing between cells in terms of line heights (for lines of the size that I specify for normal text, so 11pt in the example below), while the units of horizontal spacing would preferably be defined in terms of "the width of an 'm'", or something like that.  \documentclass[paper=a4,fontsize=11pt]{scrartcl} % KOMA-article class \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage[english]{babel} % English language/hyphenation \usepackage{geometry} \usepackage{tabu} \usepackage{lipsum}  \pagestyle{empty} % No pagenumbers/headers/footers  \newcolumntype{V}{&gt;{\vspace{0pt}}p}  \begin{document} \begin{tabular} [t]{@{}V{0.2\columnwidth}V{0.8\columnwidth}} % @{} is used to remove the margins from cells \Huge\textbf A &amp; \begin{tabular}[t]{@{}p{0.8\columnwidth}} Lorem ipsum \hfill right-aligned\\ sem.\\ Lorem\\ ipsum \end{tabular} \\  \Huge\textbf B &amp; b \\  \Huge\textbf C &amp; \lipsum*[1] \\  \end{tabular} \end{document}     Edit 2013-03-25: I tried a different approach (with minipages) and asked a question: . As of writing this, I have one answer that is similar to the accepted answer below. It achieves correct spacing, but is limited to different sizes in the left column (if one wants to use \hfill in the right column), and the top alignment for the \Huge text is not perfect.  Edit 2013-03-25: I got an answer in the thread  where \strut was used to add space, and \vphantom{Qp} (adds the vertical space of what is written in the braces(Qp in this example)). That could most likely be used here to, to get the correct spacing between cells even if only short letters or letters that do not protrude downwards are used.