How come TeXicCenter and MiKTeX always generate an A4 size pdf paper?
I reinstalled both MiKTeX and TeXicCenter and I made sure that I selected "Letter" to be my default paper size. Nothing changes.
Here is what worked for me, regardless of the documentclass or other packages used.
Right after \begin{document} I put these two lines:
\setlength{\pdfpagewidth}{8.5in}
\setlength{\pdfpageheight}{11in}
The default paper size for MikTeX is contained in some configuration file somewhere in the MikTeX directory. You can change it by starting up MikTeX's "Settings (Admin)" program, but you probably already tried that. TeXnicCenter has nothing to do with it.
You can always specify to use letter size paper, overriding the default, by adding the letterpaper option to your \documentclass command:
\documentclass[letterpaper]{article}
The paper size you specify is only used if your LaTeX document doesn't specify one. Even if you didn't do this in your documents, the class or one of the packages you are using may do this.
To explicitly choose your papersize either use
\documentclass[letterpaper]{scrreprt}
or
\usepackage[letterpaper]{geometry}
Other possible paper sizes are a0paper, a1paper, ..., a6paper, b0paper,b1paper, ...,b6paper,letterpaper,legalpaper,executivepaper`.
If you are using LaTeX=>PS=>PDF, then the following will work for you:
Goto Build->Define Output Profiles->LaTeX=>PS=>PDF.
Goto the Postprocessor tab.
Select Ghostscript (ps2pdf).
Edit the "Arguments".
Change the -sPAPERSIZE=a4 to -sPAPERSIZE=letter.
Notice that the size of the PDF is now 8.5 x 11.
Related
This is a problem I had with TexLive 2013 and 2014; working on Mac OS X, 10.8.
I have to use xelatex or lualatex because of East Asian fonts.
When using picture files with \includegraphics[settings-for-scaling]{filename}, I can only use .png files reasonably, JPEGs are always shown in their original size.
I tried this with a minimum beamer document, graphicx package loaded.
Also, I tried several ways to scale (cm, textwidth, etc.). Here are some examples:
Replaced [settings-for-scaling] in \includegraphics[settings-for-scaling]{filename} with any of the following options:
[height=6cm], [height=0.8\textheight]
[width=6cm], [width=0.9\textwidth],
[height=6cm, width=6cm], [height=0.8\textheight, width=0.9\textwidth]
[keepaspectratio, height=0.8\textheight, width=0.9\textwidth]
The last solution being preferred for beamer presentations.
I thought it might be a flaw in my settings, but it does not work with the default settings, TexLive installation seems to be OK.
My latex file is:
\title{\large\textbf{Optimizarea rela\c tiei dintre structur\u a \c si comportament \^in modelarea UML}}
\author{
Sorin Oltean \\
\textit{Universitatea Transilvania din Bra\c sov} \\
\small\textit{oltean.s#gmail.com, sorin.oltean#romtelecom.ro} \\
\small Tel.: 0752/314288
}
\documentclass[12pt]{article}
\begin{document}
\maketitle
\renewcommand\abstractname{\textit{\textbf{Abstract}}}
\begin{abstract}
Something..... text.........
\end{abstract}\\\
\textbf{Cuvinte cheie:} \textit{sistem, structur\u a, comportament, UML}
\section{Introducere}
\paragraph{ }
Para11.............
\paragraph{ }
Para2......
\bibliographystyle{abbrv}
\bibliography{main}
\end{document}
After para1, i wanna start a new paragraph, but between the paragraphs there is a blank line, how can i start the 2nd paragraph below the 1st one, without that blank space?
Also, how can i define the margins (top, down, left, right) of the document? There is too much space from the left, right, top and down, i wanna just 2cm space from the left and right, and 3cm from the top and down. Sorry for my bad english..
Also how can i specify the font name and size of the document?
Thanks!
I see you make several mistakes that are typical for beginners:
Don't use the standard classes for generic documents (article, report, book), they are too inflexible. Use the KOMA-Script classes (scrartcl, scrreprt, scrbook) or the memoir class instead.
Don't change the default settings until you have read books or articles about typography.
In particular, the default page margins are OK, there is no need to change them. Margins of 2 cm would be way too narrow.
When it comes to fonts, the answer depends on which engine you use: pdfTeX-based documents require specially-crafted packages, whereas modern engines (XeTeX and LuaTeX) can access system fonts. Like before, don't switch fonts light-heartedly. Only very few fonts of high quality are available to normal users. In particular, never use Arial or Times New Roman. On Mac OS X, you could use Hoefler Text, on Windows Cambria, for example.
Don't include formatting commands in token lists that are intended for plain strings like \title or \abstractname; use the formatting commands that your document class provides.
\paragraph is a sectioning commands that creates a heading; use blank lines to separate simple text paragraphs.
Load the inputenc package (only necessary in the case of pdfTeX) so that you can enter non-ASCII characters directly.
The \documentclass command must come first.
Don't use the geometry package unless you have very specific and unavoidable requirements.
Avoid the parskip package; modern document classes already include its functionality; and normally, paragraphs should be marked by indents, not by vertical space, so no changes to the default are required.
Never use the fullpage package, it's completely outdated.
Like the others said, start by reading some introductory material about LaTeX like the Short Introduction.
Read the document Obsolete packages and commands.
Use the geometry package. It allows full control over margins etc.
\usepackage{geometry}
\geometry{margin=2cm}
The space between paragraphs can be set via parskip:
\setlength{\parskip}{0cm}
However, parskip does not work for paragarphs introduced by \paragraph. But if your paragraphs do not need a caption (as I assume since you wrote \paragraph{}, it may be better to begin paragraphs just with a blank line:
\setlength{\parskip}{0cm}
Here goes the first paragraph.
Here the second. With no space. Note that this paragraph was introduced with a blank line.
\paragraph{The third paragraph} This paragraph will have a small offset, since it is introduced explicitly with paragraph command.
I would suggest this as a good reference to start with. Familarize yourself with the way documents are prepared for LaTeX.
1) There is no need to use \paragraph{}, just an empty line between paragraphs is enough. This will create a visible vertical space between paragraphs (that's why you wanted different paragraphs, right?). If you are bothered by the default indention for the new paragraph have a look at the documentation for \noindent or \parskip.
2) If you really have to start tweaking the page layout (i.e. your university/journal/employer doesn't already provide an accepted class or style) have a look at the geometry package.
3) There should be some fonts available in your installation already (beton, helvet, palatino?), and these can be loaded as packages. It really depends on what exactly you need to do.
For paragraphs, try putting your text inside the {} so that you have
\paragraph{
Para11.............
}
But normally I think you can just put two lines between each paragraph and not bother with \paragraph{}. Otherwise, you can change the parskip value. Wikibooks shows how but I'm not allowed to post a 2nd link. It's in the Document Structure part of the Latex wikibook.
You can use the geometry package to specify your margins:
\usepackage{geometry}
\geometry{top=3cm, left=2cm, right=2cm, bottom=3cm}
Documentation
For less margins I recommend using fullpage, i.e.
\usepackage{fullpage}
see fullpage documentation for more information
Use the geometry package to change the margins of the document
\usepackage[top=3cm,left=2cm,right=2cm,bottom=3cm]{geometry}
I think the space between the paragraphs can be configured with the package:
\usepackage{parskip}
Documentation in CTAN is here. I haven't really tested it though.
For the margins you could do it manually with , the esaiest way is to do it the following package:
\usepackage[margin=2.5cm]{geometry}
You can check documentation here.
I'd like to create a pdf/ps/eps that contains only one single formula.
I thought the easiest way would be to use latex.
Unfortunately, I found no option to specify, that the paper-size should automatically be set to fit the contents.
I found that dvipng has a "-T tight" option, that actually does the trick, but...
I want it in vector-graphics format.
Any suggestions?
Thanks.
With the standalone class, you get exactly what you want.
\documentclass{standalone}
\begin{document}
\[
x + y = z
\]
\end{document}
Try pdfcrop, it crops your pdf to the minimum. You need to have Perl installed.
for Mac, there is a little app called LaTeXit which does exactly that. http://chachatelier.fr/programmation/latexit_en.php
Fixing the bounding box of generated EPS should help:
epstopdf --gsopt=-dEPSCrop blah.eps
or eps2pdf has a -B option that detects the tightest possible Bounding Box.
Somewhat perversely, you can generate your Tex using Metapost: include your formula between btex and etex tags, and compile it following the instructions in either mptopdf(1) (prefered, part of pdftex) or mpost(1) (you'll need to run Tex separately as well, I think). It is perverse to invoke Metapost just to have it invoke Tex, but it you will get formula-sized output without any evil pdf hackery.
If you need any Latex (as opposed to plain Tex), then you need a bit of boilerplate to get this to work, cf. LaTeX labels in MetaPost.
I have been using LaTeX from sometime now, but have never actually gotten my hands dirty declaring a new command, as I try to avoid that.
However, I need to add monospace text often in my document and I use \verb for it which is fine, except that the verb font size is bigger than the normal text font. So I need to change the font size and undo done like \small{}\verb#My monospace code#\normalsize{}. This is not very convenient and mistake-prone.
Is there a better way to do this? Can I define a new command for this? How?
Why not use the \texttt{} command to get monospaced text?
I'm not sure why the \verb command is giving you text that's larger than normal (for me, \verb is exactly the same size as regular text, and \texttt{} as well). However, if you really want to make a new command to get you smaller monospaced text, you might try defining a command in your header as follows:
\newcommand{\smalltt}[1]{{\small\texttt{#1}}}
Where the [1] indicates that the command takes one argument (the text to make small and monospaced.) Then of course you'd use it as \smalltt{my smaller monospaced text.}.
Defining new commands that act like the verbatim commands is actually quite difficult. The LaTeX verbatim package contains some stuff that will help.
If you are using the times package, the Computer Modern verbatim font does not go well with the PostScript times fonts. For a more suitable verbatim (typewriter) font try
\renewcommand{\ttdefault}{aett}
As Noah says, the size should not be different between \verb text and normal output. It would be a good idea to post a small, complete example of the form:
\documentclass{article}
\begin{document}
Text and \verb|verbatim % text|.
\end{document}
If you want to pick up text to process verbatim with formatting, things are a bit complicated by the need to watch catcodes. I'd look at the fancyvrb or listings packages for this.
Put the following line in a .sty file included by your document:
\renewcommand{\verbatim#font}{\ttfamily\small}
Let me give some examples of new command:
\newcommand{\zope}{Zope}
Now whereever I give \zope in my Latex text, its replaced by the text specified above. This if I need to make a global change I can make it.
\newcommand{\bi}{\begin{itemize}}
\newcommand{\ei}{\end{itemize}}
With the help of the two commands above, now I can write my lists as:
\bi
\item 1st item
\item 2nd item
\item and so on...
\ei
This illustrates how some commands can be shortened with the help of newcommand.
Now lets consider a newcommand with a parameter.
\newcommand{\filepath}[1]{\verb!#1!}
To use this command, I would write something like \filepath{abc.xml} which will be replaced by \verb!abc.xml! on processing the command.
Another example:
\newcommand{\ida}[1]{\textcolor{blue}{#1}}
With help of this \ida{myVariable} is replaced with \textcolor{blue}{myVariable}
I hope this small tutorial will help serve the purpose.
I have a command which includes an includegraphics command - I can pass an image to my command, and it will do some standard formatting for me before actually including the image. Some of the images that I'm including via this command are smaller than \textwidth, while some are larger. I'd like to scale the larger images down to \textwidth, while not scaling the smaller images up - this means I can't just do
\includegraphics[width=\textwidth]{img}
Is there a way to specify a maxwidth? Or, can I get the width of the image somehow so I can do something like
\ifthenelse{\imagewidth > \textwidth}{%
\includegraphics[width=\textwidth]{img}}{%
\includegraphics{img}}
To get the width of the image you can use this code:
\newlength{\imgwidth}
\settowidth{\imgwidth}{\includegraphics{img}}
You could use this in the document preamble to create a new command to automatically set the width:
\usepackage{graphicx}
\usepackage{calc}
\newlength{\imgwidth}
\newcommand\scalegraphics[1]{%
\settowidth{\imgwidth}{\includegraphics{#1}}%
\setlength{\imgwidth}{\minof{\imgwidth}{\textwidth}}%
\includegraphics[width=\imgwidth]{#1}%
}
and then, in your document:
\scalegraphics{img}
I hope this helps!
I like an additional parameter for optionally scaling the image down or up a bit, so my version of \scalegraphics looks like this:
\newcommand\scalegraphics[2][]{%
\settowidth{\imgwidth}{\includegraphics{#2}}%
\setlength{\imgwidth}{\minof{#1\imgwidth}{\textwidth}}%
\includegraphics[width=\imgwidth]{#2}%
}
The adjustbox package is usefull for this. Below you will find a short example. It allows the following (besides triming, clipping, adding margins and relative scaling:
\documentclass[a4paper]{article}
\usepackage[demo]{graphicx}
\usepackage[export]{adjustbox}
\begin{document}
\adjustbox{max width=\linewidth}{\includegraphics[width=.5\linewidth,height=3cm]{}}
\adjustbox{max width=\linewidth}{\includegraphics[width=2\linewidth,height=3cm]{}}
\includegraphics[width=2\linewidth,height=3cm,max width=\linewidth]{}
\end{document}
If you use the export package option most of its keys can be used directly with \includegraphics. FOr instance the key relevant to you, max width.
If what you want to constrain is not an image but a standalone .tex file, you can slightly modify ChrisN's \scalegraphics to
\newlength{\inputwidth}
\newcommand\maxwidthinput[2][\linewidth]{%
\settowidth{\inputwidth}{#2}%
\setlength{\inputwidth}{\minof{\inputwidth}{#1}}%
\resizebox{\inputwidth}{!}{#2}
}
and then use it like so
\maxwidthinput{\input{standalone}}
\maxwidthinput[0.5\textwidth]{\input{standalone}}
And of course, adjustbox as suggested by ted will work as well:
\usepackage{adjustbox}
...
\adjustbox{max width=\linewidth}{\input{standalone}}
After a few minutes of searching through CTAN manuals and Google results, I think I can safely say that what you want to do is either impossible or very hard. My only recommendation is that you have two commands, one for small images and one for large, or one command with an option.
There may be a way, but I leave it to other S.O. LaTeX wizards to provide a better answer.
Edit: I am wrong, see above.