I want to have the picture exactly in a specific position in my text. I use the commands below
\begin{enumerate}
\item T.D. Lee(1957 Physics Nobel Laureate)
\begin{figure}
\begin{center}
\includegraphics[scale=0.5]{TdLee.eps}
\end{center}
\end{figure}
I have many figures like this. What happens is that I see figures and items in different order. Can you let me know which latex command i should use in order to have the picture under or right to the each item?
Thanks
Kurt
To work with the standard float system, you might try the h positioner (as mentioned in another answer) but with the ! modifier as in
\begin{figure}[h!]
...
\end{figure}
There is even another H positioner, like h! but tries harder. It needs the package float
\usepackage{float}
...
\begin{figure}[H]
...
\end{figure}
but even that doesn't work many times. However since you are doing this in a list, trying to use a float might not be the best for you.
You might try to create a minipage to house the figure. Or perhaps the way to do what you want might be to omit the figure environment all together but keep the center one if you want it.
If you know exactly where you want the figure, don't use a float (that's what the "figure" environment is)...floats are there to.....wait for it.....float!
So if you know exactly where you want your figure, simply use \includegraphics:
\begin{enumerate}
\item T.D. Lee(1957 Physics Nobel Laureate)
\begin{center}
\includegraphics[scale=0.5]{TdLee.eps}
\end{center}
...
\end{enumerate}
You can also redefine the enumerate environment so that you do not have to surround each picture with a \begin{center}...\end{center} environment, but if you are interested in how to do that, I'll leave it for a separate question. (And unapologetically suggest that you ask it on the TeX Stack Exchange, where no TeX-related question is too small.)
Try the h placement specifier. From here:
\begin{figure}[h]
\centering
\includegraphics[scale=0.5]{TdLee.eps}
\end{figure}
It does not guarantee perfect placement, but it tries.
Related
I am using LaTeX for research with hexagonal chains and would like to know some ways to create the a horizontal hexagonal chain. So far I only have some going vertically; I have used code I received on here under a previous question but haven't figured out how to rotate the vertical chain of hexagons to make it horizontal.
Is it possible to use chemfig or tikz to create a chain similar to either of these?
Here is an example with the chemfig package
\documentclass{article}
\usepackage{chemfig}
\begin{document}
\begin{figure}
\centering
\chemfig{*6(--*6(--*6(-----)---)----)}
\caption{Chain of 3 hexagons}
\end{figure}
\end{document}
And the corresponding output
Looking for the best way to fit a figure tightly that spans the full height of a page. I'm writing a document about the ionosphere and want to include this image along the side: https://en.wikipedia.org/wiki/Thermosphere#/media/File:EarthAtmosphereBig.jpg
Seems like a job for minipage but I can't quite figure out a good solution. Any tips?
You can achieve this by placing two minipages, one with a larger width than the other, side-by-side.
\documentclass[12pt]{article}
\usepackage[demo]{graphicx} %demo option should be omitted in real document
\usepackage{lipsum} %for random text, should be omitted in real document
%--------%Shows page layout, also should be omitted in real document.
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%--------%Idea from Zarko of TEX.SE
\begin{document}
\begin{minipage}{0.8\textwidth}
\lipsum[1-3]
\end{minipage}
\begin{minipage}[r]{0.2\textwidth}
\centering
\includegraphics[width=0.2\textwidth, height=\textheight]{demo.png}
\end{minipage}
\end{document}
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 3 years ago.
Improve this question
I am trying to write a CV in Latex, but now I am stuck. Since I want to learn Latex, I don't really want to just use a template.
I am thinking about one page divided in to columns/minipages:
Left column: an image + contact information etc.
Right Column: Education, experience, volunteer work etc.
Tried minipages and columns, but the image is destroying the whole format... Tried to use parts from templates, which worked fine, i.e. secsty etc. See example under.
Not a specific question, but hope someone has a good idea for how to make something out of this idea :)
Example:
%Preamble
\documentclass[a4paper]{article}
\usepackage{graphicx}
\usepackage{geometry}
\geometry{a4paper, total={170mm,257mm}, left=10mm, top=10mm}
\pagestyle{empty}
%%% Custom sectioning (sectsty package)
\usepackage{sectsty}
\sectionfont{\usefont{OT1}{phv}{m}{n}\sectionrule{0pt}{0pt}{-10pt}{1pt}}
\subsectionfont{\usefont{OT1}{phv}{m}{n}}
%Document
\begin{document}
\begin{minipage}[250mm]{0.4\linewidth}
\includegraphics{image.png}
Date of birth:
Phone:
Email:
\end{minipage}
\begin{minipage}[250mm]{0.65\linewidth}
\part*{Name}
\section*{EDUCATION}
\section*{EXPERIENCE}
\end{minipage}
\end{document}
It is great to see that you don't simply copy one of the existing templates, but want to learn some latex instead.
Some comments about your code:
if you want the minipages besides each other to emulate columns, their combined sum has to be equal or smaller than the linewidth. In your example 0.4+0.65= 1.05, so they won't fit in one line. In fact I would make them a bit smaller and add a \hfill between to get a bit of space between them
to make sure each minipage is only as wide as you specified, I would add the [width=\linewidth] option to the image. This will automatically scale the image correctly
if you want both minipages in one line, don't leave an empty line between them. In latex and empty line in the source code is interpreted as a paragraph break, thus forcing your second minipage in a new line
To get a better vertical alignment of the image, I would remove the optional height argument from the minipage and let tex determine how high your minipages are and add the options [T] and [b] respectively to determine the vertical alignment
this is more a design question: at the moment your page geometry is highly asymmetric. You can visualise this by adding showframe to your geometry options, e.g. \geometry{a4paper, total={170mm,257mm}, left=10mm, top=10mm,showframe}. Are you sure this is a good choice for a CV?
%Preamble
\documentclass[a4paper]{article}
\usepackage{graphicx}
\usepackage{geometry}
\geometry{a4paper, total={170mm,257mm}, left=10mm, top=10mm}
\pagestyle{empty}
%%% Custom sectioning (sectsty package)
\usepackage{sectsty}
\sectionfont{\usefont{OT1}{phv}{m}{n}\sectionrule{0pt}{0pt}{-10pt}{1pt}}
\subsectionfont{\usefont{OT1}{phv}{m}{n}}
%Document
\begin{document}
\noindent
\begin{minipage}[T]{0.4\linewidth}
\includegraphics[width=\linewidth]{example-image-duck}
Date of birth:
Phone:
Email:
\end{minipage}%
\hfill
\begin{minipage}[b]{0.55\linewidth}
\part*{Name}
\section*{EDUCATION}
\section*{EXPERIENCE}
\end{minipage}
\end{document}
I have a LaTeX-document using the class
\documentclass[12pt,a4paper]{scrbook}
and I changed some parameters for positioning the floats:
\renewcommand{\topfraction}{1} %default: 0.7
\renewcommand{\bottomfraction}{1} %default: 0.3
\renewcommand{\textfraction}{0.1} %default: 0.2
\renewcommand{\floatpagefraction}{1} %default: 0.6
\setcounter{topnumber}{3}
\setcounter{bottomnumber}{3}
I have two graphics that should be among each other and fill one single page. I don't know why, but because LaTeX always splits both graphics on two pages, I put both graphics into one figure-environment. It doesn't matter whether I use [ht] or [p] the figure with both graphics moves to the end of the chapter. I don't get any overfull warnings. So I think it might not the reason that the figure is too large.
\begin{figure}[p]
\centering
\includegraphics{graphic1.pdf}
\newcaption{caption 1} % <-- using \usepackage{picins}
\label{fig:pic1}
\vspace{5mm}
\includegraphics{graphic2.pdf}
\newcaption{caption 2}
\label{fig:pic2}
\end{figure}
Is there someone, who can explain that behaviour of LaTeX and can recommend a solution.
This is standard behaviour in latex because it takes care of all positioning. I personally wouldn't mess this up and would instead refer to the images.
If you nevertheless want to position them at the given line in the text:
Use the package float and place your images this way.
\usepackage{float}
\begin{figure}[H]
...
\end{figure}
I misunderstood the meaning of \floatpagefraction....
It describes the minimum size that a float must have, so that you can use [p]. Setting it to a value of 1 (100% of the page) makes definitely no sense.
bad:
\renewcommand{\floatpagefraction}{1}
good:
\renewcommand{\floatpagefraction}{0.6} %default: 0.6
Default values generally are not so bad......
If you want to have your images right where you want them to be, just use
/usepackage{float}
and edit your image code as follows.
\begin{figure}[H]
\centering
\includegraphics{graphic1.pdf}
\newcaption{caption 1} % <-- using \usepackage{picins}
\label{fig:pic1}
\end{figure}
\vspace{5mm}
\begin{figure}
\includegraphics{graphic2.pdf}
\newcaption{caption 2}
\label{fig:pic2}
\end{figure}
I notice that there is some gap after my table. See the following snapshot:
My LaTeX code is:
\begin{table}[htb]
\caption{Error rates VS training size in AdaBoosted stump, SVM and kNN. \label{tab:examplecount8000errerrplot}}
\begin{center}
\begin{tabular}{c c}
\includegraphics[scale=0.4]{../boost.eps}
&
\includegraphics[scale=0.4]{../svm.eps} \\
\includegraphics[scale=0.4]{../knn.eps}
& \\
\end{tabular}
\end{center}
\end{table}
%
\subsection{Feature Numbers}
Is the gap normal or how can I reduce the gap to be normal?
Instead of centering the tables with the {center} environment, try to use the \centering macro. I should be something like
\begin{table}
\centering
...
\end{table}
If Charles's and midtiby's answers don't fix it for you and you must adjust it (because, for instance the margin lady won't pass your dissertation until you do), you can diddle the lengths
\floatsep
\textfloatsep
\intextsep
(and their two column brethren) which adjust the spacing around and between floats. In this case I believe you want \textfloatsep.
But do what Charles and midtiby said first, and consider Bears' advice as well.
You can always fix vertical spacing by emitting a vskip command, say \vskip{-1em}, in vertical mode, such as before the \section. Bears is right: delay worrying about layout as late as possible. There should be a saying about premature formatting...
The table would look more attractive to me if the caption was at the bottom. The matter of appearance would be as much what is the proportion of space above and below the caption as the total amount of space.
You can use \raggedbottom
\begin{table}
\centering
...
\end{table}
\raggedbottom
Undeleted answer, since this was referred to by dmckee. I'm generally against fiddling about with the way you express content: better live with the unwanted space, change things in the style files (per dmckee's suggestion), change what you want to express (like where captions are), or put in pure band-aid (like vspace). So I don't like this answer, since terminating every row of a tabular with a \\ makes them easier to maintain, like ending C blocks with a semicolon.
Delete the last \\ in the tabular environment.
try this in your tables: \setlength\belowcaptionskip{-20pt}