LaTeX - Set small fontsize for the entire document - latex

I want to change the font size to small for the entire document. I have searched online. But I am not able to find a reasonable (one line) answer. Is this possible to change the font size of latex document by only one command.? Thanks.

I think either
\documentclass[10pt]{article}
where you replace 10 with whatever font point-size you want, or, perhaps less likely,
\begin{document}
\small
where you replace \small with whatever size-command you want, might be what you are looking for.

Related

Presentation with latex, changing the width in each frame

In my presentation, I use \usetheme{Warsaw} and in order to increase the usable space in each frame, I use \useoutertheme{infolines}. In this way, the bar at the bottom of each page is equally divided between author's name, title, and date and slide number. Is there anyway to change the width of each section? For example, I need more space for the title compared to author's name or date. Any comment is highly appreciated. Also, the code I am using is the following:
\usepackage{beamerthemesplit}
\usetheme{Warsaw}
\useoutertheme{infolines}
\title[...]{...}
\author[...]{...}
\institute{...}
\date{...}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
Thank you.
Find the beamerouterthemeinfolines.sty file (in the ...\latex\beamer\themes\outer folder). You will see that the 1:1:1 width is hard-coded using wd=.333333\paperwidth for each box, so you will have to edit the style file.
The following is not tested, but should set you on the right path.
Change those values as you want, then save the file under a different name, say beamerouterthemeunevenlines.sty. Now use unevenlines as your outer theme.

How to control font sizes in pgf/tikz graphics in latex?

I'm creating graphs in pgf/tikz. When I use these in my document they are scaled, several are in minipage/subfig like environments. When this happens the font sizes are scaled with the graphics making them very small or unreadable. I've been through the manual but have so far been unsuccessful in my attempts to control this.
Is there a way to set the font size directly? What options are there?
One aswer given below shows how to how to use the \tikzstyle font option to specify the font size within the tikzpicture environment.
Right now I am using:
\beginppgfgraphicnamed{graph}
\input{graph.tex}
\endpgfgraphicnamed
The tikzpicture environment is used in the input file. Are there anyways to specify font size in the setup I'm using? Is this perhaps the issue? The graph.tex file is generated automatically via another program.
In addition to setting font size for individual graphics it would be ideal to have a parameter to globally set font size for all tikz graphics? I guess the issue is the scaling in minipage or subfig.
Many thanks,
Jay
\begin{tikzpicture}
\tikzstyle{every node}=[font=\small]
\end{tikzpicture}
will give you font size control on every node.
I found the better control would be using scalefnt package:
\usepackage{scalefnt}
...
{\scalefont{0.5}
\begin{tikzpicture}
...
\end{tikzpicture}
}
I believe Mica's way deserves the rank of answer, since is not visible enough as a comment:
\begin{tikzpicture}[font=\small]
\begin{tikzpicture}
\tikzstyle{every node}=[font=\fontsize{30}{30}\selectfont]
\end{tikzpicture}
You can also use:
\usepackage{anyfontsize}
The huge advantage of the anyfontsize package over scalefnt is that one does not need to enclose the entire {tikzpicture} within a \scalefont environment.
Just adding \usepackage{anyfontsize} to the preamble is all that is required for the font scaling magic to happen.

How do I control the width of a \caption{} in a float? (LaTeX)

I am looking for a simple way to control the width of a \caption{} inside a float in LaTeX without using the {caption} package. Any clues?
(EDIT): The problem I am having is that the built-in captions are too narrow.
In general, to control the width of objects in TeX, you can use a minipage, for instance:
\begin{minipage}[t]{1.85in}
\caption{ Why would you eat a pickle? }
\end{minipage}
However, with a caption you might need to do something different as it could very well be a macro.
To change the formatting of the standard LaTeX classes without using a package, you need to look at the source of the standard LaTeX classes and alter the original definitions in your own document. Printing captions is done by the macro \#makecaption, which has definition (in article.cls):
\long\def\#makecaption#1#2{%
\vskip\abovecaptionskip
\sbox\#tempboxa{#1: #2}%
\ifdim \wd\#tempboxa >\hsize
#1: #2\par
\else
\global \#minipagefalse
\hb#xt#\hsize{\hfil\box\#tempboxa\hfil}%
\fi
\vskip\belowcaptionskip}
If you wrap the whole thing in a minipage environment (as suggested to be done manually in the other answers), you should get the results you want.
Is it easier than loading a package? Not really, but it can be instructive.
There's nothing too magical about \caption; it just consults a figure/table number and than formats your text at a font and size that the document class likes. So you can control its width the same way you'd control the width of any text:
Wrap the \caption{...} in a \parbox or a \begin{minipage}...\end{minipage}.

Inserting images in LaTeX

I have a question on inserting images into a LaTeX document. I try to insert images using the keyboard short cut: Ctrl-Alt-G and I'm able to insert images. But the compiled pdf document shows all the images at the end, whereas I want to interleave images with text. Something like the following:
Text1
Image1
Text2
Image2
Text3
Image3
I try to insert images at right positions i.e. in between text, but on compilation, they all appear at the end. I have tried different options provided on the image insertion UI but same result.
Any idea where I'm going wrong.
Related SO question.
You'll have to use graphicx package:
\usepackage{graphicx}
and then you just use \includegraphics
\includegraphics{myfig.pdf}
\includegraphics[width=60mm]{myfig.png}
\includegraphics[height=60mm]{myfig.jpg}
\includegraphics[scale=0.75]{myfig.pdf}
\includegraphics[angle=45,width=52mm]{myfig.jpg}
Try downsizing the images. Maybe they are too large and so they are moved to the end of the document..
Hope it helps.
What code did you use for the \figure environment? In most cases the "h" option should at least help a little bit there.
This is a FAQ: "Moving tables and figures in LaTeX". Note especially the third dot point, which relaxes some of the restrictions LaTeX uses to position floats.
That's the best answer I can give without seeing an example of how large your floats are and how you're inserting them into the document. Provided that they're reasonably-sized, you should have no problem with
\begin{figure}[htbp]
\includegraphics{myfig}
\caption{...}
\label{fig:myfig}
\end{figure}
And note that if the float is too large to fit then it will move to a subsequent page -- this is the whole idea behind getting LaTeX to help you with the formatting. You certainly don't want to end a page prematurely just because there's a figure coming up next that otherwise doesn't fit.
Maybe this can help you in general...I just hate the LaTeX way of making everything too advanced (flexible) at all times.
Beside, the source looks really awful.
It will not solve you initial problem, but since it will be easier to change size of each image you can at least try...
% Easy image insert
% use as \img{imagename}{caption}{label}
% will insert image with with 70% of textwidth
% change below for other width
\newcommand{\img}[3]{
\begin{figure}[!ht]
\centering
\includegraphics[width=0.7\textwidth]{#1}
\caption{#2}
\label{fig:#3}
\end{figure}
}
\img{myimage}{has this caption}{and_this_label}
the label is automatically prefixed with fig:.
Good luck!
/C
Using [!t] and [!h] in the figure environment, rather than [t], [h] etc seems to help, though I've yet to find a surefire way to get large images in sensible places. Sometimes it works half way through a document, othertimes it doesn't.
Sometimes just changing the width or height using an option to the includegraphics statement (square brackets before the filename a.k.a \includegraphics[width=foo]{}) will do the trick.
\begin{figure}[H!]
\includegraphics{myfig}
\caption{...}
\label{fig:myfig}
\end{figure}
Use H! to denote that you want your picture right there.
\documentclass{article}
\usepackage{graphicx}
\begin{document}
text
\begin{figure}[tbh]
\centering
\includegraphics[width=0.4 \textheight]{ & directory path of jpg. width defines the width of the page and one one can put in its place height which is text page height }
\caption{name of the jpg}
\end{figure}
% it worked for me.
\end{document}

Math operator in specifying figure width in LaTeX

In LaTeX figures, one can use \textwidth and \columnwidth to specify sizes of the graphic relative to the size of surrounding text, e.g.
\includegraphics[width=.5\textwidth]{myimage}.
I would like to easily switch from onecolumn to twocolumn template (and back) without the figure growing too large for onecolumn template. For twocolumn template (where \columnwidth is roughly half the \textwidth), I would like to have something like:
\includegraphics[width=.9\columnwidth]{myimage}.
and for onecolumn template (where \columnwidth and \textwidth are equal):
\includegraphics[width=.5\textwidth]{myimage}.
Now, I figured I could limit this using some kind of a min operator:
\includegraphics[width=min(.5\textwidth,.9\columnwidth)]{myimage} but this is invalid syntax. Is there something like this to solve this problem, possibly through the use of LaTeX macro system?
Although it's possible to write this sort of macro, I wouldn't want to hardcode it into each figure; how about something like this
\makeatletter
\newlength \figwidth
\if#twocolumn
\setlength \figwidth {0.9\columnwidth}
\else
\setlength \figwidth {0.5\textwidth}
\fi
\makeatother
and then use
\includegraphics[width=\figwidth]{myimage}
to insert the graphic.
\textwidth is the horizontal width of the page body and not really appropriate for your purposes.
\linewidth is the width of the current line; it will be updated appropriate to columns, indentation, etc.
The following paragraph produces a picture that should precisely fit the entire line width (i.e. no overful warning):
\noindent\includegraphics[width=\linewidth]{myimage}
If you prefer small margins on the left and right, you can use:
\begin{center}
\includegraphics[width=.9\linewidth]{myimage}
\end{center}
Or, if you want to specify the margins in an absolute size:
\usepackage{calc}
...
\begin{center}
\includegraphics[width=\linewidth-20pt]{myimage}
\end{center}
Hmm... the code above (\if#twocolumn etc.) is not working for me at all. No idea why not. :( tetex on osX using fink. Trying to use revtex4, so perhaps that's the problem. I really like the idea of this type of change because I'm going to be dorking with widths etc. for my thesis and various journal articles, and to have these distances specified with a macro may be helpful for these types of conversions.
Any comments greatly appreciated!
-Allen
Somebody else who is more familiar with this will probably answer, but note that you would also need to change your figure type to be figure* if you are going two-column.

Resources