when using \listoffigues and \listoftables the numbers and the captions overlap each other. For example: "2-10 laminar flow" --> 10 and lam overlap each other.
I'd like to add horizontal space without changing the format.
I tried "\l#figure{\#dottedtocline{1}{0em}{6em}}" already. The horizontal space is fine now, but this command added vertical space between the lines which I don't want.
The tocloft package changes the entire format so I don't want to use it.
Any ideas how to change the horizontal space between numbers and caption only?
Related
I'm trying to show step by step how to sort an array. But since the numbers and letters take up different amounts of space, the columns get staggered. I'm very new to latex and am not sure if there's an easy fix for this.
If that's not possible, is there some kind of grid system I can use to keep them in straight lines? (without showing the grid).
You can place each of the elements in a box that are of similar width and height. This will ensure that each take up the same amount of space. It's possible using eqparbox's \eqmakebox[<tag>][<align>]{<stuff>}. All \eqmakeboxes with the same <tag> are put in a box of maximum width of <stuff>. You can adjust the <align>ment of every element, if needed (centred, left-aligned or right-aligned).
\documentclass{amsart}
\usepackage{eqparbox}
\newcommand{\swl}[2][nmbr]{\eqmakebox[#1]{\strut #2}}
\begin{document}
\begin{tabular}{c}
\swl{a}\swl{b}\swl{m}\swl{0} \\
\swl{i}\swl{i}\swl{1}\swl{n}
\end{tabular}
\end{document}
The above code provides a wrapper \swl[<tag>]{<stuff>} that provides a similar-width letter macro. If you want a blank space, you can use \swl{~}.
eqparbox uses TeX's \label-\ref system to store the widths and therefore requires at least two compilations for any change (increase in width) in elements under the same <tag>.
I'm trying to get a way to automatically adjust the size of a minipage.
I am creating a report which will have several "paragraphs" that have a floating image on the left and some text on the right of that image and eventually below it if there is enough text. The both of them ( image + text ) make together a "semantic block".
First I did that :
\begin{wrapfigure}{L}{0.15\textwidth}
\centering
\includegraphics[width=0.1\textwidth]{image}\\
\emph{image caption with no "figure1"}
\end{wrapfigure}
Text related to this image\\
Text related to this image\\
Text not related to this image\\
and of course the text not related to the image was considered like the other lines of text, printing on the right of the image.
So i tried to wrap it all :
\begin{minipage}[c][10cm]{20cm}
\begin{wrapfigure}{L}{0.15\textwidth}
\centering
\includegraphics[width=0.1\textwidth]{image}\\
\emph{image caption with no "figure1"}
\end{wrapfigure}
Text related to this image\\
Text related to this image\\
\end{minipage}
Text not related to this image\\
but it really isn't convenient and the height is fixed.
If there is a better way to do it not using minipage that would be great too.
In the end i plan to make it into a \newenvironment taking 2 parameters : image name and text so I can use it easily in the article.
EDIT: fixed a typo in 2nd code
In my thesis I'm including already published papers. I've extracted pages as individual EPS files and I'm shrinking them so they fit on one page within the margins (\pageScale).
\hfill{}\includegraphics[scale=\pageScale]{Integrative-Theory-Associative/eps-pages/page-1}\hfill{}
While this works ok, the pages appear extremely small to fit in the margins. I'd like to increase the size of the graphics beyond the margins such that header and page number information would overlap with margins of the inserted pages.
eso-pic allows me to fill the whole page with my inserted pages, but the header and page number overlap with the text in the inserted pages:
\mbox{}
\AddToShipoutPictureBG*{
\includegraphics{Integrative-Theory-Associative/pdf-pages/page-1.pdf}
}
\newpage
I's like to scale down and centre the graphics on the page so they are as big as possible while text within the graphics is not behind the header and is within the margins.
I don't mind manually figuring out the right scale for graphics, but I can't figure how to place the centre of a smaller graphic in the centre of the margins. \AtPageCenter
does not do what I expected, centre the centre of the graphic, not centre the lower left of the graphic.
In the example below I've used some of adjustbox's prowess to adjust included content:
\documentclass{article}
\usepackage{fancyhdr,lipsum}% Just for this example
\fancyhf{}
\fancyhead[C]{This is some random header text}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{.4pt}
\renewcommand{\footrulewidth}{.4pt}
\pagestyle{fancy}
\usepackage[export]{adjustbox}
\usepackage{eso-pic}
\newcommand{\pictureincenteroftextblock}[2][]{%
\AddToShipoutPictureBG*{%
\AtTextLowerLeft{%
\raisebox{.5\textheight}{%
\hspace*{.5\textwidth}%
\makebox[0pt]{\includegraphics[max width=\textwidth,max height=\textheight,valign=c,#1]{#2}}%
}%
}%
}%
}
\begin{document}
\lipsum[1-5]
\clearpage
\mbox{}% Just put something on this page.
\pictureincenteroftextblock{example-image-a}
\clearpage
\mbox{}% Just put something on this page.
\pictureincenteroftextblock{example-image-10x16}
\clearpage
\mbox{}% Just put something on this page.
\pictureincenteroftextblock{example-image-1x1}
\clearpage
\mbox{}% Just put something on this page.
\pictureincenteroftextblock{example-image-a4}
\end{document}
With the [export] option, adjustbox adds its key-values to graphicx's \includegraphics options. Those I've used are max width and max height which will shrink the included image (or page from a PDF) if the width or height exceeds these maxima while still maintaining the included image/page aspect ratio. Additionally, valign=c will align the content in a vertically centred fashion.
eso-pic is used to place the image in the background, starting at the lower-left part of the text block. Then, through standard spacing commands, it's raised into position (\raisebox) and shoved over (\hspace) to the centre of the text block. Finally the image is horizontally centred (\makebox[0pt]).
Hi I'm using LateX. I have a block of text that I'd like to have a small box like space highlighting the are (just like a \begin{equation} but for text).
Is there such a thing in LateX?
I'm not 100% sure what you're asking I'm afraid, but if you just want to indent text with a margin on each side of the page to make it stand out, you can use...
\begin{quotation}
Quotation is good for long blocks of text that you want highlighted
\end{quotation}
\begin{quote}
Quote is suited to a single block of quoted text.
\end{quote}
If you actually want to have a physical black box around the text, you might want to consider wrapping it in a tabular / table, or you might want to delve into minipages and/or par box environments...
Is \makebox what you're looking for?
To create boxes of text that behave differently from the rest of the text, we can use
\makebox[width][pos]{text}
The width sets the width the of the box. The pos sets the positioning of the text - either r (right justified text), l (left justified), or s (stretched to fill the box). If the pos parameter is left out, as in \makebox[1in]{centerme}, the text is centered. The text is placed in the box. If you want to draw a box around the text, use \framebox just as you would use \makebox.
\mbox{text} and \fbox{text} are quick versions of \makebox and \framebox, which create a box to fit the size of the text.
There are some more examples at http://www.artofproblemsolving.com/wiki/index.php?title=LaTeX:Layout#Boxes
I've been looking for a more elegant solution to the following typesetting problem. Consider those banners found in print media where the text is aligned like:
B I G T E X T
small text small text small text
m o r e m e d i u m t e x t
The font sizes are adjusted so that the height is scaled down for longer lines of text such that each line has equal width. I've written a small script that runs each line separately, compiles, crops the resulting pdf and then \includegraphics each in a table. This gives the desired effect but requires an both an outside script and pdfcrop (which only crops to a white bounding box). Since much of LaTeX is self-aware, I imagine it would be possible to have it recognize the width of a box and scale it appropriately so that any text fits exactly into the desired width.
Any thoughts or ideas on how a pure LaTeX implementation might work?
EDIT As a supplement to the suggested solution by AVB (since large code in comments looks awful), I've posted below the code used so that others may find it easily.
\documentclass[]{article}
\usepackage[pdftex]{graphicx}
\begin{document}
\begin{table}[l]
\resizebox{10cm}{!}{BIG Text} \\
\resizebox{10cm}{!}{small text small text small text} \\
\resizebox{10cm}{!}{Medium Text Medium Text}
\end{table} \end{document}
First, read the TeX FAQ entry titled Changing the space between letters. Depending on your circumstances, the packages and recommendation in that FAQ may suffice.
Also, take a look at the \scalebox and \resizebox commands in the graphicx package. They do what the names imply.
I'm sure that this could be improved upon, and due to different font implementations at different sizes then it isn't going to be exact, but here's a quick-and-dirty way to do it:
\documentclass[10pt]{article}
\usepackage{pgfmath}
\usepackage{anyfontsize}
\newlength{\mywidth}
\newlength{\testwidth}
\setlength{\mywidth}{4in}
\newcommand{\fixedwidth}[1]{%
\settowidth{\testwidth}{#1}%
\pgfmathsetmacro{\x}{round(\mywidth/\testwidth * 10)}%
\pgfmathsetmacro{\y}{round(\mywidth/\testwidth * 15)}%
\bgroup\fontsize{\x pt}{\y pt}\selectfont#1\egroup}
\begin{document}
\fixedwidth{hello world}
\fixedwidth{greetings earthlings}
\end{document}
In practice, it's a little less than the 4in, but the two lines of text do get scaled to the same amount.
Check out the package textfit. Usage:
\scaletowidth{width}{text}
or
\scaletoheight{height}{text}