I have the following latex code:
% Preamble
% ---
\documentclass{article}
% Packages
% ---
\usepackage{amsmath}
\usepackage{graphicx}
\begin{document}
\title{Electronics Equations}
\author{Tyler Hilbert}
\date{}
\maketitle
\begin{figure}
\includegraphics[width=50mm]{FormulaWheel.png}
\end{figure}
Ohm's Law: V = I*R
\bigskip
Current: I = dQ/dt
Voltage: V = dw/dQ
Power: p = dw/dt
\end{document}
When I compile and create a pdf I get the following result:
What I am wondering is why is the figure after all the equations? I put the figure in before the equations because I wanted it at the beginning. How can I make it at the top of the document where it is relative to the other elements like in the ordering in the code?
You are using the figure environment, which is a float environment. The idea is to let latex figure out its optimal place. If you do not want that, than just use \includegraphics[width=50mm]{FormulaWheel.png} directly (just delete the \begin{figure} and \end{figure} lines).
You can find more details about floats here.
Related
How can I print on Epson L4160, or any other printer the presentation made in Latex connected with Beamer, having scale of frame 16:9? My trouble is strange, because I don't want to have a white bars... But, what I have discovered, on the preview in Adobe Reader, in full screen preview it looks very good...
Snapshot of printing:
Snapshot of fullscreen presentation:
And code: (due to many lines, I can paste it on other page if it is necessary)
\documentclass[polish,aspectratio=169]{beamer}
\usepackage[utf8]{inputenc}
\usepackage{polski}
\usepackage{ragged2e} %justify
\usepackage[inline]{enumitem}
\usepackage{multicol}
\usepackage{gensymb} %degree
\usepackage{colortbl} %color of row
\usepackage{cancel} %fraction cancel line
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{url} %bibliography
\usepackage{amsmath}
\usepackage{subcaption}
\usepackage{scalerel}
\DeclareMathOperator*{\Bigcdot}{\scalerel*{\cdot}{\bigodot}}
\usetikzlibrary{positioning, calc}
\usetheme{Warsaw}
\definecolor{myAmber}{rgb}{1.0, 0.49, 0.0} %#FF7E00
\usecolortheme[named=myAmber]{structure}
\setlength{\parindent}{0pt}
\title{Wprowadzenie do matematyki}
\subtitle{2. Koniunkcja i alternatywa w zdaniach.}
\author{Konstanty Dmochowski}
%\date{}
\expandafter\def\expandafter\insertshorttitle\expandafter{%
\insertshorttitle\hfill \hspace*{3.85cm}%
\insertframenumber\,/\,\inserttotalframenumber}
\makeatletter
\long\def\beamer##ssection*#1{\beamer#section[]{}}
\makeatother %remove section both from header and outline in beamer
\newcommand{\lcancel}[2]{\cancel{#1}_{#2}}
\newcommand{\ucancel}[2]{\cancel{#1}^{#2}}
\newcommand*{\rechterWinkel}[3]{% #1 = point, #2 = start angle, #3 = radius
\draw[shift={(#2:#3)}] (#1) arc[start angle=#2, delta angle=90, radius = #3];
\fill[shift={(#2+45:#3/2)}] (#1) circle[radius=2.5\pgflinewidth];
}
%\special{pdf:encrypt ownerpw (prezentacjaPL2020) userpw (prezentacja2020) length 128 perm 2052}
\AtBeginSection[]
{
\begin{frame}
\frametitle{Plan pracy}
\tableofcontents[currentsection]
\end{frame}
}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\begin{frame}
\frametitle{Plan pracy}
\tableofcontents
\end{frame}
\section{Wprowadzenie}
\begin{frame}{O czym będziemy mówili?}
\begin{figure}[h!]
\begin{center}
\includegraphics[scale=0.2]{idea-3383766_1280.jpg}
\end{center}
\caption{Jak sądzicie?}
\end{figure}
\end{frame}
\begin{frame}{Przypomnienie}
\justify
Do tej pory mówiliśmy wyłącznie o \textbf{zdaniach logicznych} i ich \textbf{zaprzeczeniach}.
\\[0.25cm]
\pause
\textbf{Przykład:} \textit{Kwadrat ma nieskończenie wiele osi symetrii.}
\pause
\\[0.25cm] Są to tak zwane zdania proste - wyrażają one bowiem jedną myśl, składają się z jednego orzeczenia.
\pause \\[0.25cm] \textcolor{myAmber}{Pytanie:} Co się dzieje, gdy zdanie jest bardziej rozbudowane, skomplikowane? W jaki sposób wówczas z nim poradzić?
\end{frame}
\subsection{Zdania złożone}
\begin{frame}{Zdania złożone}
\justifying
Okazuje się, że zdania tej postaci:
\\[0.25cm] \pause \textit{Wojtek poszedł do kina lub zjawił się na stadionie.}
\\[0.25cm] \pause \textit{Eliza narysowała dom i wymieniła cieńkopis.}
\pause \\[0.25cm] prowadzą nas do nowego pojęcia: \textbf{zdania złożonego}. Powiedzmy coś o nich.
\end{frame}
To get more or less the same aspect ration than a A4 paper, you could modify the page geometry like this:
\documentclass[polish,aspectratio=169]{beamer}
\usepackage[utf8]{inputenc}
\usepackage{polski}
\usepackage{ragged2e} %justify
%\usepackage[inline]{enumitem}
%\usepackage{multicol}
\usepackage{gensymb} %degree
%\usepackage{colortbl} %color of row
\usepackage{cancel} %fraction cancel line
%\usepackage{graphicx}
\usepackage{tikz}
%\usepackage{url} %bibliography
%\usepackage{amsmath}
\usepackage{subcaption}
\usepackage{scalerel}
\usetheme{Warsaw}
\definecolor{myAmber}{rgb}{1.0, 0.49, 0.0} %#FF7E00
\usecolortheme[named=myAmber]{structure}
\title{Wprowadzenie do matematyki}
\subtitle{2. Koniunkcja i alternatywa w zdaniach.}
\author{Konstanty Dmochowski}
\makeatletter
\setlength\beamer#paperwidth{16.00cm} \setlength\beamer#paperheight{11.31cm}
\geometry{%
papersize={\beamer#paperwidth,\beamer#paperheight},
hmargin=2cm,%
vmargin=0cm,%
head=1cm,% might be changed later
headsep=0pt,%
foot=1cm% might be changed later
}
\makeatother
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\end{document}
Some other comments about your code:
don't use enumitem with beamer
beamer has its own column mechanism, multicol is not necessary
if you need something from the colortbl package, use the xcolor={table} documentclass option instead of loading the package
you don't need graphicx
you also don't need url - beamer loads hyperref
no need for amsmath either, beamer already loads this
using floating specifier such as [h!] in a documentclass without floating mechanism makes no sense
don't use \begin{center}...\end{center} within your figures. This adds additional vertical space and is also unnecessary because figures are centred by default
don't abuse \\ for line breaks. Leave an empty line instead
instead of manually numbering things like Definicja 1., use an appropriate environment like definition, these can be made to number things automatically
Just give the filename of images without file type. Latex will automatically choose the best suited type in case you have the image in different formats
have a look at the booktabs package. Data prison style tables are really ugly
it should be \justifying and not \justify (the later kinda works by accidents, but causes many strange problems because it actually is an environment and not a macro)
when I want to refer to for example an equation, I do the following:
\begin{align}
R= \frac{c * \Delta T}{2}
\label{eqn:Range}
\end{align}
Now I want to refer to \ref{eqn:Range}.
Then the output is the following:
Now I want to refer to 3.4.
I would like that the output is already:
Now I want to refer to equation 3.4.
Without me having to write equation manually.
The same goes also for tables and figures.
Especially for figures, I would like to know if there are more possibilities to display the reference.
For example with the following:
\begin{figure}[t]
\centering
\includegraphics[width=0.7\textwidth]{Example}
\caption{Example caption}
\label{fig:ExampleRef}
\end{figure}{}
I would like to be able to get also the caption displayed: Figure 1.1: Example caption.
Thank you for your help.
This sounds like a job for the cleveref package:
\documentclass{article}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage[noabbrev]{cleveref}
\begin{document}
\begin{align}
R= \frac{c * \Delta T}{2}
\label{eqn:Range}
\end{align}
Now I want to refer to \cref{eqn:Range}.
\begin{figure}[t]
\centering
\includegraphics[width=0.7\textwidth]{example-image-duck}
\caption{Example caption}
\label{fig:ExampleRef}
\end{figure}
\cref{fig:ExampleRef}
\end{document}
I put two image.png in my latex documnet using \includegraphics. Now I want to joint two points of these images together by a line. I wonder if it is possible to do so in Latex?
First: no it is impossible: as Gyro Gearloose had said LaTeX has no idea about the content of your png.
Second: sure you can ;-) A little cheat with tikz. You can connect two arbitrary points with an arrow (or a line).
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{lipsum}
\usepackage{pgfplots}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{tikzmark} % arrows in tex
\usetikzlibrary{arrows} % arrows in tex
\usetikzlibrary{calc} % (node)+(3cm,2cm)
\tikzstyle{every picture}+=[remember picture]
\begin{document}
\lipsum[1]
\includegraphics[width=0.2\textwidth]{solidtex.png}
{\tikz\node[coordinate](start1){};}
\lipsum[2]
{\tikz\node[coordinate](end1){};}
\includegraphics[width=0.2\textwidth]{solidtex.png}
\lipsum[3]
\begin{tikzpicture}[overlay, remember picture, -latex, color=blue!15!red, yshift=1ex, shorten >=1pt, shorten <=1pt, line width=0.1cm]
\path[->] (start1) edge [out=150, in=240] (end1);
\end{tikzpicture}
\end{document}
But it still connects the corners of the images. To connect points inside the pictures, you have to modify the coordinates manually e.g.:
\path[->] (start1) edge [out=150, in=240] ($(end1)+(2cm,2cm)$);
or pt, ex, mm ect...
If you want line without arrow head, use:
\path[-] (start1) edge [out=150, in=240] (end1);
Note that like labeling and referring figures, you have to run latex (or pdflatex or ...) twice.
I have the problem that LaTeX doesn't show the List of figures and List of Listings. I don't know where the problem is.
I'm working with TeXstudio and the code was defined as follows:
\begin{document}
\begin{lstlisting}[caption={Testcode is here}\label{lst:Testcode is here},frame=single]
//here is the code
\end{lstlisting}
\begin{figure}[H]
\centering
\includegraphics[width=0.5\textwidth]{pic1.jpg}
\caption{That is a pic}
\label{fig: That is a pic}
\end{figure}
\listoffigures
\lstlistoflistings
\end{document}
Both lists remain empty. Can anyone tell me what the problem is??
I am able to generate the list of figures by doing these modifications on your file;
Adding these two lines to the very beginning of the file:
\documentclass{article}
\usepackage{listings}
and then, changing [H] into [h] (lower case).
#Winsoft There is nothing wrong with using [H] you just need to add the float-package (see https://tex.stackexchange.com/questions/132106/difference-between-h-and-h-in-float-position).
Adding the minimal set of needed packages compiled to the desired result. Please note that the list of figures and list of listings won't show up before compiling the document twice.
\documentclass{article}
\usepackage{listings}
\usepackage{graphicx}
\usepackage{float}
\begin{document}
\begin{lstlisting}[caption={Testcode is here}\label{lst:Testcode is here},frame=single]
//here is the code
\end{lstlisting}
\begin{figure}[H]
\centering
\includegraphics[width=0.5\textwidth]{pic1.jpg}
\caption{That is a pic}
\label{fig: That is a pic}
\end{figure}
\listoffigures
\lstlistoflistings
\end{document}
I am trying to add a simple figure into my latex code .I have this code :
\begin{figure}[H]
\resizebox{40pt}{!}{
\centering \includegraphics{FigureStereo.jpg}}
\caption{Epipolar Geometry}
\label{fig:cclogo}
\end{figure}
with this however the text comes on top of the image and also image is not centered .What am I doing wrong?Hopefully this is not a repeated question coz I did do a quick check on related posts.
Edited
Here is the preamble
\documentclass[draftthesis,tocnosub,noragright,centerchapter,12pt,]{uiucecethesis09}
\makeatletter
\usepackage{setspace}
\usepackage{epsfig} % for figures
\usepackage{graphicx} % another package that works for figures
%\usepackage{subfigure} % for subfigures
\usepackage{amsmath} % for math spacing
%\usepackage{amssymb} % for math spacing
%\usepackage{url} % Hyphenation of URLs.
\usepackage{lscape} % Useful for wide tables or figures.
\usepackage[justification=raggedright]{caption} % makes captions ragged right - thanks to Bryce Lobdell
\usepackage{float}
\usepackage{wrapfig}
% Uncomment the appropriate one of the following four lines:
\msthesis
%\phdthesis
%\otherdoctorate[abbrev]{Title of Degree}
%\othermasters[abbrev]{Title of Degree}
\title{}
\author{}
\department{}
\degreeyear{}
% Advisor name is required for
% - doctoral students for the ProQuest abstract
% - master's students who do not have a master's committee
\advisor{}
% Uncomment the \committee command for
% - all doctoral students
% - master's students who have a master's committee
%\committee{Professor Firstname Lastname, Chair\\
% Professor Firstname Lastname} % etc.
You can use a center environment for centering, wrapping it around both the image box and the caption:
\begin{figure}[h!]
\begin{center}
\resizebox{40pt}{!}{\includegraphics{FigureStereo.jpg}}
\caption{Epipolar Geometry}
\label{fig:cclogo}
\end{center}
\end{figure}
Note, though, that LaTeX can sometimes be pretty stubborn about how it lays out pages where floating elements are concerned. The h option is more of a guideline than a guarantee. In some cases you might be better off not using a floating figure environment and instead inserting the graphics and text directly.
Also, you're better off asking this sort of question over at the TeX StackExchange site.
You probably just want something like
\begin{figure}[t]
\centerline{\includegraphics[width=\columnwidth]{figs/foo}}
\caption{Caption Goes Here}
\label{fig:cclogo}
\end{figure}