Thanks in advance for your help!
I know similar questions have been asked, but I cant get any of them to work. I am trying to get the caption to be the same width as the image I am captioning.
Here is the code: it results in all of the words falling in line after the Figure title (image attached to show what it currently looks like.1
\documentclass[twoside,twocolumn]{article}
\usepackage{blindtext} % Package to generate dummy text throughout this template
\usepackage[sc]{mathpazo} % Use the Palatino font
\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\linespread{1.05} % Line spacing - Palatino needs more space between lines
\usepackage{microtype} % Slightly tweak font spacing for aesthetics
\usepackage[english]{babel} % Language hyphenation and typographical rules
\usepackage[hmarginratio=1:1,top=32mm,columnsep=20pt]{geometry} % Document margins
\usepackage[hang, small,labelfont=bf,up,textfont=it,up]{caption} % Custom captions under/above floats in tables or figures
\usepackage{booktabs} % Horizontal rules in tables
\usepackage{lettrine} % The lettrine is the first enlarged letter at the beginning of the text
\usepackage{enumitem} % Customized lists
\setlist[itemize]{noitemsep} % Make itemize lists more compact
\usepackage{abstract} % Allows abstract customization
\renewcommand{\abstractnamefont}{\normalfont\bfseries} % Set the "Abstract" text to bold
\renewcommand{\abstracttextfont}{\normalfont\small\itshape} % Set the abstract itself to small italic text
\usepackage{titlesec} % Allows customization of titles
\renewcommand\thesection{\Roman{section}} % Roman numerals for the sections
\renewcommand\thesubsection{\roman{subsection}} % roman numerals for subsections
\titleformat{\section}[block]{\large\scshape\centering}{\thesection.}{1em}{} % Change the look of the section titles
\titleformat{\subsection}[block]{\large}{\thesubsection.}{1em}{} % Change the look of the section titles
\usepackage{fancyhdr} % Headers and footers
\pagestyle{fancy} % All pages have headers and footers
\fancyhead{} % Blank out the default header
\fancyfoot{} % Blank out the default footer
\fancyhead[C]{Test} % Custom header text
\fancyfoot[RO,LE]{\thepage} % Custom footer text
\usepackage{titling} % Customizing the title section
\usepackage{hyperref} % For hyperlinks in the PDF
\usepackage{graphicx}
\graphicspath{ {./images/} }
\setlength{\droptitle}{-4\baselineskip} % Move the title up
\pretitle{\begin{center}\Huge\bfseries} % Article title formatting
\posttitle{\end{center}}
\setlength\parindent{24pt}
\usepackage{float}
\usepackage{floatrow}
\usepackage{pdfpages}
\newsavebox\mysavebox
\begin{document}
\begin{figure}[t]
\includegraphics[width=7.5cm]{img1.jpg}
\centering
\caption{Imaged tunnel slide of yeast. This image depicts how yeast cells were counted to determine sample concentrations. Small budding cells were not included in the total cell count. Note: 4× relay lens and 40× objective used. A ${1.75x10^6}$ mL volume is shown.}
\label{fig:mesh1}
\end{figure}
\end{document}
Very important: never ignore error messages. If an error tells you that you mustn't use floatrow with the float package, don't ignore this error and remove one of the packages.
Then if you don't want the caption to have an hanging indent, remove the hang option from the caption package.
don't abuse the letter x as multiplication symbol. Use \times instead.
have a look at the siunitx package to get correct spacing and fonts for units
with 7.5cm your image is too wide for your column, a warning in the log file will tell you this. You can avoid this by using \linewidth.
\documentclass[twoside,twocolumn]{article}
\usepackage{blindtext} % Package to generate dummy text throughout this template
\usepackage[sc]{mathpazo} % Use the Palatino font
\usepackage[T1]{fontenc} % Use 8-bit encoding that has 256 glyphs
\linespread{1.05} % Line spacing - Palatino needs more space between lines
\usepackage{microtype} % Slightly tweak font spacing for aesthetics
\usepackage[english]{babel} % Language hyphenation and typographical rules
\usepackage[hmarginratio=1:1,top=32mm,columnsep=20pt]{geometry} % Document margins
\usepackage[small,labelfont=bf,up,textfont=it,up]{caption} % Custom captions under/above floats in tables or figures
\usepackage{booktabs} % Horizontal rules in tables
\usepackage{lettrine} % The lettrine is the first enlarged letter at the beginning of the text
\usepackage{enumitem} % Customized lists
\setlist[itemize]{noitemsep} % Make itemize lists more compact
\usepackage{abstract} % Allows abstract customization
\renewcommand{\abstractnamefont}{\normalfont\bfseries} % Set the "Abstract" text to bold
\renewcommand{\abstracttextfont}{\normalfont\small\itshape} % Set the abstract itself to small italic text
\usepackage{titlesec} % Allows customization of titles
\renewcommand\thesection{\Roman{section}} % Roman numerals for the sections
\renewcommand\thesubsection{\roman{subsection}} % roman numerals for subsections
\titleformat{\section}[block]{\large\scshape\centering}{\thesection.}{1em}{} % Change the look of the section titles
\titleformat{\subsection}[block]{\large}{\thesubsection.}{1em}{} % Change the look of the section titles
\usepackage{fancyhdr} % Headers and footers
\pagestyle{fancy} % All pages have headers and footers
\fancyhead{} % Blank out the default header
\fancyfoot{} % Blank out the default footer
\fancyhead[C]{Test} % Custom header text
\fancyfoot[RO,LE]{\thepage} % Custom footer text
\usepackage{titling} % Customizing the title section
\usepackage{hyperref} % For hyperlinks in the PDF
\usepackage{graphicx}
\graphicspath{ {./images/} }
\setlength{\droptitle}{-4\baselineskip} % Move the title up
\pretitle{\begin{center}\Huge\bfseries} % Article title formatting
\posttitle{\end{center}}
\setlength\parindent{24pt}
%\usepackage{float}
\usepackage{floatrow}
\usepackage{pdfpages}
\newsavebox\mysavebox
\begin{document}
\begin{figure}[t]
\includegraphics[width=\linewidth]{example-image-duck}
\centering
\caption{Imaged tunnel slide of yeast. This image depicts how yeast cells were counted to determine sample concentrations. Small budding cells were not included in the total cell count. Note: 4× relay lens and 40× objective used. A ${1.75 \times 10^6}$ mL volume is shown.}
\label{fig:mesh1}
\end{figure}
\end{document}
Related
UPDATE:
Ok i think a lot of problems are solved now. First I needed to include ttf. Than I had some issues with the headlines. But the last listing will show my solution :D Thank you :D
(step 1 of 3)
Hi I want to change my standard font of my overleaf testfile..
The example is strange because I need to write a custom comand before my code.
But I just want to use my ttf as standard everywhere!
%
% Example of how to use a custom TTF font by following the directions here:
% http://math.stanford.edu/~jyzhao/latexfonts.php
%
% In this case, the custom font is LoKinderSchrift, from
% http://www.fonts101.com/fonts/view/Uncategorized/22887/LoKinderSchrift
%
\documentclass{article}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\newcommand\customfont[1]{{\usefont{T1}{custom}{m}{n} #1 }}
\title{Example: Custom Font}
\author{writeLaTeX}
\begin{document}
\maketitle
Normal Font Text.
\Huge\customfont{Custom Font Text!}
\end{document}
(Step2 of 3)
Ok thank you I was able to introduce my ttf into my document.
It looks like the numebr is to small?
How to delete the point after
the number at chapter?
ODD
The Table of content looks ok.
How to make Chapter names bold?
content looks ok
% !TeX TS-program = xelatex
\documentclass{report}
\usepackage[german]{babel}
%\usepackage[utf8x]{inputenc} % don't use `utf8x`
%\newcommand\customfont[1]{{\usefont{T1}{custom}{m}{n} #1 }}
\usepackage{titlesec}
\titleformat{\chapter}[hang]{\Huge\bfseries}{\thechapter{. }}{0pt}{\Huge\bfseries}
\usepackage{fontspec}
\setmainfont{test.ttf}
\title{Example: Custom Font}
\author{writeLaTeX}
\begin{document}
\maketitle
\tableofcontents
\chapter{Testchapter}
How to delete the point before the chapter?
The NUMBER looks smaller than the TEXT ?!
WHY?
\section{testsection}
this is a section test
Normal Font Text.
\section{testsection}
this is a section test
Normal Font Text.
\section{testsection}
this is a section test
Normal Font Text.
\section{testsection}
this is a section test
Normal Font Text.
It
\chapter{Testchapter}
How to delete the point before the chapter?
Why
this is a chaptertext
\section{testsection}
this is a section test
Normal Font Text.
\section{testsection}
this is a section test
Normal Font Text.
\section{testsection}
this is a section test
Normal Font Text.
\section{testsection}
this is a section test
Normal Font Text.
It
\end{document}
(step 3 of 3)
Final solution:
\documentclass[report]{scrreprt}
\usepackage[fontsize=12pt]{fontsize}
\usepackage[left=6cm,right=1cm,top=1.5cm,bottom=1cm,includeheadfoot]{geometry}
\usepackage[ngerman]{babel}
\usepackage{blindtext}
\usepackage{fontspec}
\setmainfont{test.ttf}
\begin {document}
\tableofcontents
\blinddocument
\end {document}
I suggest to compile your document with xelatex or lualatex. This way, you can use the fontspec package and easily use fonts installed on your computer or even just .ttf files:
% !TeX TS-program = xelatex
\documentclass{article}
\usepackage[english]{babel}
%\usepackage[utf8x]{inputenc} % don't use `utf8x`
%\newcommand\customfont[1]{{\usefont{T1}{custom}{m}{n} #1 }}
\usepackage{fontspec}
\setmainfont{lokisd__.ttf}
\title{Example: Custom Font}
\author{writeLaTeX}
\begin{document}
\maketitle
Normal Font Text.
\Huge Custom Font Text!
\end{document}
So I have the following document:
\include{preamble}
\title{test title}
\begin{document}
\maketitle
\begin{equation*}
\begin{aligned}
\pi\sqrt{\pi\sqrt{\pi\sqrt{\pi\sqrt{\pi\sqrt{\pi\dots}}}}}
\end{aligned}
\end{equation*}
\bibliographystyle{plain}
\bibliography{references}
\end{document}
the contents of my preamble.tex file is:
%%%%% Document Setup %%%%%%%%
\documentclass[10pt,onecolumn]{revtex4} % Font size (10,11 or 12pt) and column number (one or two).
\usepackage{times} % Times New Roman font type
\usepackage[a4paper, left=1.85cm, right=1.85cm,top=1.85cm, bottom=1.85cm]{geometry} % Defines paper size and margin length
\usepackage[font=small, labelfont=bf]{caption} % Defines caption font size as 9pt and caption title bolded
\usepackage{graphics,graphicx,epsfig,ulem} % Makes sure all graphics works
\usepackage{amsmath} % Adds mathematical features for equations
\usepackage{etoolbox} % Customise date to preferred format
\usepackage{subcaption}
\usepackage{caption}
\makeatletter
\patchcmd{\frontmatter#RRAP#format}{(}{}{}{}
\patchcmd{\frontmatter#RRAP#format}{)}{}{}{}
\renewcommand\Dated#name{}
\makeatother
\usepackage{fancyhdr}
\def\bibsection{\section*{References}} % Position reference section correctly
\usepackage{import}
\usepackage{pdfpages}
\usepackage{transparent}
\usepackage{xcolor}
\newcommand{\incfig}[2][1]{%
\def\svgwidth{#1\columnwidth}
\import{./figures/}{#2.pdf_tex}
}
\pdfsuppresswarningpagegroup=1
For some reason the title just will not be included on the pdf when I compile the code, I am sure I have \title{} and \maketitle in the correct positions. Any help as to why this is would be much appreciated.
Move the title after \begin{document}:
\documentclass{revtex4}
\begin{document}
\title{test title}
\maketitle
\end{document}
(don't do this with other documentclasses. Most of the time it is better to have the \title in the preamble, e.g. to get sensible pdf meta data if combined with hyperref)
I used \let\clearpage\relax to keep two chapters on one page and this is causing the page number on proceeding page not to be displayed.
Is there a way I can undo the command in the document and still keep two chapters one page?
More detail provided.
\documentclass[12pt,a4paper]{report}
\usepackage[left=3cm,right=3cm,top=-2cm,bottom=4cm]{geometry}
\usepackage[utf8x]{inputenc}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{placeins}
\usepackage{tocloft}
\usepackage{ifthen}
\usepackage{fancyhdr}
\usepackage{lipsum}
\usepackage{float}
\floatstyle{plaintop}
\restylefloat{table}
\usepackage{caption}
\captionsetup[table]{skip=10pt}
\pagestyle{fancy}
\usepackage{setspace}
\makeatletter
% addition for not showing 'Chapter 1'
\def\#makechapterhead#1{%
\vspace*{50\p#}%
{\parindent \z# \raggedright \normalfont
\interlinepenalty\#M
\Huge \bfseries
\ifnum \c#secnumdepth >\m#ne
\thechapter\nobreakspace
\fi
#1\par\nobreak
\vskip 40\p#
}}
\#ifundefined{chapter}%
{}%
{\renewcommand{\chaptermark}[1]{%
\ifthenelse{\value{chapter} < 1}%
{\markboth{#1}{}}%
{\markboth{\thechapter\ #1}{}}
}}
\addtolength{\headheight}{\baselineskip}
\renewcommand{\headrulewidth}{0.4pt} %% thin line under header
%\renewcommand{\headrulewidth}{0pt} %% no line under header
\renewcommand{\footrulewidth}{0pt}
\fancyhf{} %% Clear all fields.
%\fancyhead[LE,RO]{\sffamily\thepage}
%\fancyhead[LO,RE]{\sffamily\nouppercase{\leftmark}}
\fancyhead[R]{\sffamily\thepage}
\fancyhead[L]{\sffamily\nouppercase{\leftmark}}
\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\fancyfoot[C]{\sffamily\thepage} % except the center
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}
\makeatother
The problem was caused by a combination of two factors:
you document uses different page styles for chapter pages and normal pages. On chapter pages, the page number had been at the bottom centre, on normal pages there was a header with the chapter title and the page number
you were using the geometry package with a large negative top margin. This pushed the header of normal pages off the page and you did no longer see the page number on them.
Proposed solution:
use a reasonable values for the page geometry, e.g. \usepackage[left=3cm,right=3cm,top=2cm,bottom=4cm]{geometry}
This also has the advantage, that one can remove most of the hard codes \vspaces in your figures and tables
if you'd like to remove the header and move the page number to the bottom centre on all normal pages, the following definitions can be used:
\fancyhf{} % clear all header and footer fields
\fancyfoot[C]{\sffamily\thepage} % except the center
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
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}
I have the following problem with my latex document (see the red marked area in the picture). I want to scratch the words like in the green marked area.
I guess that this misbehavior evolves through my style settings.
\documentclass[fontsize=12pt,parskip=full,normalheadings,a4paper]{scrartcl}
\usepackage[a4paper,inner=40mm,outer=30mm,top=33mm,bottom=30mm]{geometry}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{times} % font-style
\usepackage{graphicx} % figures
\usepackage[square]{natbib} % for references
\usepackage{csquotes} % quotes
\usepackage{verbatim} % comment-environment
\linespread{1.10} % line distance
\DeclareGraphicsRule{.pdftex}{pdf}{.pdftex}{} % for xfig
\usepackage{tabularx} % tables
\usepackage{srcltx} % forward/reverse search in dvi
\usepackage[perpage,marginal,hang]{footmisc} % make special footnote symbols
\sloppy % prevent overfull boxes
%\usepackage[ngerman]{babel} % damit das Inhaltsverzeichnis auf deutsch ist
%% styling the header and footer
\usepackage[headsepline]{scrpage2} % separation line in the header
\clearscrheadfoot
\automark[subsection]{section}
\lehead[]{\leftmark}
\lohead[]{\rightmark}
\rehead{\pagemark}
\rohead{\pagemark}
\pagestyle{scrheadings}
%% color
\usepackage{color}
\usepackage{xcolor}
\definecolor{darkred}{rgb}{.5,0,0}
\definecolor{darkblue}{rgb}{0,0,.5}
\usepackage[plainpages=false,pdfpagelabels,colorlinks=true,urlcolor=darkblue,pagecolor=darkred,
citecolor=black,linkcolor=black]{hyperref}
%% settings for caption
\usepackage[font=footnotesize,labelfont=bf,textfont=it,singlelinecheck=false,format=hang]{caption}
% counter hack for setting the counter for the listings
\usepackage{chngcntr}
\counterwithin{figure}{section}
\counterwithin{table}{section}
If you can, please tell me, which option I have to change in order to get a 'fine word stretching' for the whole document.
As always, thanks for your fast and helpful answers.
Matthias
I think that your problem is connected with url. Url adress is printed as one word without spaces. You may add \newline before "http://...."