I've a enumerate list and some items have figures. I write this:
\begin{enumerate}
\item Estado da arte:
\item Levantar os requisitos
\item Com o microcontrolador
\ref{figurametodo3}.
\begin{figure}[h!]
\begin{center}
\includegraphics[scale=0.6]{./dados/figuras/metodo_3}
\caption{Sistema para leitura da identificação de uma Tag}
\label{figurametodo3}
\end{center}
\end{figure}
\item Estudar
\begin{figure}[h]
\begin{center}
\includegraphics[scale=0.4]{./dados/figuras/metodo_4}
\caption{Comunicação entre o microcontrolador e o celular}
\label{figurametodo4}
\end{center}
\end{figure}
\item Desenvolver
\begin{figure}[h]
\begin{center}
\includegraphics[scale=0.6]{./dados/figuras/metodo_final}
\caption{Comunicação entre celulares e servidor}
\label{figura22}
\end{center}
\end{figure}
\end{enumerate}
But it aligns all figures below the list, outside of place that I want. I want that my figures stay just below that your item. Inside of the list.
This is covered in the following FAQs:
How to influence the position of float environments like figure and table in LaTeX?
Keeping tables/figures close to where they are mentioned
Force LaTeX image to appear in the section in which it's declared
Here's one option using the float package and it's [H]ERE float specifier:
\documentclass{article}
\usepackage{float,graphicx}
\begin{document}
\begin{enumerate}
\item Item 1
\item Item 2
\item Item 3
\begin{figure}[H]
\centering
\includegraphics[width = .5\linewidth]{example-image-a}
\caption{A figure caption}
\end{figure}
\item Item 4
\begin{figure}[H]
\centering
\includegraphics[width = .5\linewidth]{example-image-b}
\caption{B figure caption}
\end{figure}
\item Item 5
\item Item 6
\end{enumerate}
\end{document}
Use minipage environment to insert the image:
\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{caption}
\begin{document}
\begin{enumerate}
\item Estado da arte:
\item Levantar os requisitos
\item
\begin{minipage}[t]{\linewidth}
Com o microcontrolador \newline
\includegraphics[scale=0.6]{./dados/figuras/metodo_3}
\captionof{figure}{Sistema para leitura da identificação de uma Tag}
\end{minipage}
\end{enumerate}
\end{document}
You should not use figure, if you don't want a float.
The LaTeX Wikibook explains:
Floats are containers for things in a document that cannot be broken
over a page. LaTeX by default recognizes "table" and "figure" floats,
[...].
Floats are there to deal with the problem of the object that won't fit
on the present page, and to help when you really don't want the object
here just now.
To provide a caption outside of figures one needs to use package caption, which provides the captionof command.
There is also a capt-of package if you are just interested in using the command \captionof.
The answer by Werner is nice but you do have to type in the mandatory "Item 3" besides the "\item" command, for example. Supposing you just want to include a figure on an item on the list without adding any text, there is the following dirty trick:
\item \phantom{text}
\includegraphics[scale=0.5]{Image}
Note that the blank space between these two lines of code is absolutely necessary. In case you want more space between the item label and the diagram, the following could be done:
\item \phantom{text}
\vspace{3mm}
\includegraphics[scale=0.5]{Image}
Related
I want to write horizontal bullet points in latex. How can I do that? as far as I got some solution on the internet is a vertical list with numbers.
How can I get bullet points instead of numbers?
My current code is something like this-
\documentclass[twoside = false, % doppelseitiger Druck
DIV=17, % DIV Faktor für Satzspiegelberechnung, sie Doku zu KOMA Script
BCOR=15mm, % Bindekorrektur
chapterprefix=false,
headinclude=true,
footinclude=false,
pagesize, % write pagesize to DVI or PDF
fontsize=11pt, % use this font size
paper=a4, % use ISO A4
bibliography=totoc, % write bibliography-chapter to table of contents
index=totoc, % write index-chapter to table of contents
cleardoublepage=plain, % \cleardoublepage generates pages with pagestyle empty
headings=big, % A4/B5
listof=flat, % improved list of tables
numbers=noenddot
]{scrbook}
\begin{inparaenum}
\item A
\item B
\item C
\item D
\item E
\item F
\item G
\end{inparaenum}
\end{document}
Assuming you are using the paralist package... use the inparaitem instead of inparaenum
\documentclass[11pt]{article}
\usepackage{paralist}
\begin{document}
This list includes the following :
\begin{inparaitem}
\item option A
\item option B
\item option C
\end{inparaitem}\\
Please choose an option
\end{document}
For horizontal list:
\documentclass{article}
\usepackage[inline]{enumitem}
\begin{document}
Text before list.
\begin{enumerate*}
\item My first in list.
\item My second in list.
\end{enumerate*}
Text after list.
\end{document}
For more examples, please visit overleaf.
I have this problem:
\begin{center}
\begin{minipage}{2in}
\begin{enumerate}[{1)}]
\item $p \lor \neg q$ Agregacion
\item $q \ent p$ Equivalenica
\end{enumerate}
\end{minipage}
\end{center}
I want that the text in every item (not the math part) aligned with the text from above .
Like a list, where I can said what rule I applied with text.
Like if every item have "2 columns" the left one for the equation and the right one for a kind of explanation.
If I understood correctly, you would like to have an enumerate list with two columns: math expressions and texts.
Since you already have the list, I would customise it via enumitem and then enclose equations inside makebox to make sure equations span the same space (basically the same approach as samcarter_is_at_topanswers.xyz's but with slightly expanded example). The most involved part is a set of list parameters; it keeps text within a column should it span multiple lines.
This approach will fail if you have a more complex equations, though
\documentclass{article}
\usepackage{amsmath}
\usepackage{enumitem}
\newlength\firstcollen % Controls first column length
\AtBeginDocument{\setlength\firstcollen{0.3\textwidth}}
\usepackage{kantlipsum} % Just for dummy text
\newcommand\itemmath[1]{\item%
\parbox[t]{\firstcollen}{\ensuremath{#1}}%
\ignorespaces}
\begin{document}
\begin{enumerate}[
label=\arabic{enumi}),
labelwidth=2.5em,
labelsep=0.5em,
labelwidth=2em,
leftmargin=\dimexpr+\firstcollen+2.5em,
itemindent=-\firstcollen,
% listparindent=\parindent, parsep=0pt, % Simulates paragraphs
listparindent=0pt, parsep=3pt, % No indentation, small separation
align=left,
]
\itemmath{y = f(x)}Short equation
\itemmath{r^2 = \cos^2 x + \sin^2 x} A trigonometric identity
\itemmath{\int_{a}^{b}\frac{1}{2}f(x)dx} \kant*[1][1]
\itemmath{y = f(x)} Short equation
\itemmath{r^2 = \cos^2 x + \sin^2 x} \kant[3][1]\kant[3][2]\kant[3][3]
\itemmath{b = \int_{c}^{d}\frac{3}{4}g(x)dx} Short text
\itemmath{\int_{a}^{b}\frac{1}{2}f(x)dx} \kant[1][1-5]\kant[2]
\end{enumerate}
\end{document}
You could use \makebox to ensure that all your equations have the same width:
\documentclass{article}
\usepackage{mathtools}
\usepackage{enumerate}
\begin{document}
\begin{center}
\begin{minipage}{2in}
\begin{enumerate}[{1)}]
\item \makebox[2cm][l]{$p \lor \neg q$} Agregacion
\item \makebox[2cm][l]{$q p$} Equivalenica
\end{enumerate}
\end{minipage}
\end{center}
\end{document}
Hope you're doing well.
Imagine I have the following Sheet:
5:20:58 xxxx: entro con el mismo xxxx
5:21:08 xxxx: xxxx
5:21:58 xxxxx: Perfecto, te pido de 5 a 10 minutos mientras
reviso la configuración de las etiquetas. ¿De acuerdo?
5:22:04 xxxxx: ok
I need to delete the datetime of all those rows. The result
xxxx: entro con el mismo xxxx
xxxx: xxxx
xxxxx: Perfecto, te pido de 5 a 10 minutos mientras
reviso la configuración de las etiquetas. ¿De acuerdo?
xxxxx: ok
Is there a formula in Google Sheets to make this?
I tried with REPLACE, SPLIT but is not applicable to all the rows in the sheet.
(The real sheet has too many rows, I extracted a part from the sheet to give an example)
EDIT
(following OP's comment)
...there are sometimes that the data not starts with a timestamp. ... How can I adjust the formula to make it work?
Please use the following altered formula
=INDEX(IFERROR(REGEXEXTRACT(B1:B;" (.*)");B1:B))
OR (for an even more robust formula)
=INDEX(IFERROR(REGEXEXTRACT(B1:B;"^\d+:\d+:\d+ (.+)");B1:B))
Original answer
Please use the following formula (adjust range to your needs)
=INDEX(IFERROR(REGEXEXTRACT(B1:B;" (.*)")))
OR (depending on your locale)
=INDEX(IFERROR(REGEXEXTRACT(B1:B," (.*)")))
Functions used:
INDEX
IFERROR
REGEXEXTRACT
Let's say your raw data is in A2:A. Place this in the second cell (e.g., B2) of an otherwise empty column:
=ArrayFormula(IF(A2:A="",,TRIM(REGEXREPLACE(A2:A,"\d+:\d+:\d+",""))))
ADDENDUM:
Version for some international locales (where semicolon is used in place of a comma within formulas):
=ArrayFormula(IF(A2:A="";;TRIM(REGEXREPLACE(A2:A;"\d+:\d+:\d+";""))))
I have a text file which contains a series of movie titles, which looks like this once opened.
A Nous la Liberte (1932) About Schmidt (2002) Absence of Malice
(1981) Adam's Rib (1949) Adaptation (2002) The Adjuster (1991) The
Adventures of Robin Hood (1938) Affliction (1998) The African Queen
(1952)
Using the code below:
def movie_text():
moviefile = open("movies.txt", 'r')
yourResult = [line.split('\n') for line in moviefile.readlines()]
movie_text()
I get nothing.
Your code doesn't prints right.
If I understand it well,
moviefile = open("movies.txt", 'r')
lines=moviefile.readlines()
print(len(lines)) # Shows list size
for line in lines:
print(line[:1]) # The [:1] part cuts the \n
The method readlines returns a list, I am not sure why your use split. I mean, if all you want is to remove the '\n', you can do it in many ways, being the one I used just one of them.
Hope it works!
I am trying to extract all the info, using a regular expression in R, after the first number and first word of an entry in a data frame.
For example:
Header =
c("2006 Volvo XC70",
"2012 Ford Econoline Cargo Van E-250 Commercial",
"2012 Nissan Frontier",
"2012 Kia Soul 5dr Wagon Automatic")
I want to write a pattern that will grab Volvo XC70, or Econoline Cargo Van E-250 Commercial (everything after the year and make) from an entry in my "header" column so that I may run the function on my data frame and create a new "model" column. I can't figure out a pattern that will allow me to skip the first string of integers, then a space, then the first string of characters, and then a space, and then grab everything proceeding.
Any help would be appreciated. Thanks!
Just use sub.
sub("^\\d+\\s+\\w+\\s+", "", df$x)
Example:
x <- "2012 Ford Econoline Cargo Van E-250 Commercial"
sub("^\\d+\\s+\\w+\\s+", "", x)
# [1] "Econoline Cargo Van E-250 Commercial"
For this task, I would fetch a basic list using the XML package:
library(XML)
doc <- xmlParse('http://www.fueleconomy.gov/ws/rest/ympg/shared/menu/make')
Now that we fetched the XML data we can create a vector with the car makes:
mk <- xpathSApply(doc, '//value', xmlValue)
Finally, I'll compile the pattern and play around with sprintf and sub:
df$Makes <- sub(sprintf('\\d+ (?:%s) ', paste(mk, collapse='|')), '', df$Header)
Output:
## Header
# 1 2006 Volvo XC70
# 2 2012 Ford Econoline Cargo Van E-250 Commercial
# 3 2012 Nissan Frontier
# 4 2012 Kia Soul 5dr Wagon Automatic
## Makes
# 1 XC70
# 2 Econoline Cargo Van E-250 Commercial
# 3 Frontier
# 4 Soul 5dr Wagon Automatic