I don't really need a lot of changes to the default article document class. All I want is:
redefine page margins (I want them to be the same on all pages, but different from the default values);
use title page;
add more elements on the title page (title, author and date is not enough for me, I want company and company logo to be on the title page as well);
change styles of the sections, subsections and subsubsections (I don't want the numbers to be shown, otherwise - they're good).
Perhaps, there are some packages that could be helpful in this case?
There are a number of packages that can help you achieve the results you're looking for. The packages I've selected below are the ones I like, but there is more than one way to do it.
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{paulius-article}[2009/02/25 v0.1 Paulius' modified article class]
% Passes and class options to the underlying article class
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
\ProcessOptions
% Load LaTeX's article class with the `titlepage' option so that \maketitle creates a title page, not just a title block
\LoadClass[titlepage]{article}
% Redefine the page margins
% TODO: Adjust margins to your liking
\RequirePackage[left=1in,right=1in,top=1in,bottom=1in]{geometry}
% Remove the numbers from all the headings (\section, \subsection, etc.)
\setcounter{secnumdepth}{-1}
% To modify the heading styles more thoroughly use the titlesec package
%\RequirePackage{titlesec}
% Adjust the title page design
% NOTE: This is the default LaTeX title page -- free free to make it look like whatever you want.
% TODO: Add company name and logo somewhere in here.
\newcommand{\maketitlepage}{%
\null\vfil
\vskip 60\p#
\begin{center}%
{\LARGE \#title \par}%
\vskip 3em%
{\large
\lineskip .75em%
\begin{tabular}[t]{c}%
\#author
\end{tabular}\par}%
\vskip 1.5em%
{\large \#date \par}% % Set date in \large size.
\end{center}\par
\#thanks
\vfil\null%
\end{titlepage}%
}
% This some before-and-after code that surrounds the title page. It shouldn't need to be modified.
% I've pulled out the part the actually typesets the title page and placed it in the \maketitlepage command above.
\renewcommand\maketitle{\begin{titlepage}%
\let\footnotesize\small%
\let\footnoterule\relax%
\let \footnote \thanks%
\maketitlepage%
\setcounter{footnote}{0}%
\global\let\thanks\relax
\global\let\maketitle\relax
\global\let\#thanks\#empty
\global\let\#author\#empty
\global\let\#date\#empty
\global\let\#title\#empty
\global\let\title\relax
\global\let\author\relax
\global\let\date\relax
\global\let\and\relax
}
% TODO: If there are any other article modifications required, add them here.
% That's all, folks!
\endinput
You'll want to read the documentation for the geometry package to adjust the margins. The titlesec package can be used if you want to modify the appearance of the headings (aside from just turning off the numbers).
The titlepage is LaTeX's default title page. You'll need to modify it to add your company name and logo. I've separated out the "stuff to be printed" from all the other code associated with the title page. You should only need to change the \maketitlepage command. In your document, use \maketitle to print the title page.
\documentclass{paulius-article}
\title{My New Document Class}
\author{Paulius}
\usepackage{lipsum}% provides some filler text
\begin{document}
\maketitle% Actually makes a title page
\section{Section Heading}
\subsection{Look no numbers!}
\lipsum[1-10]
\end{document}
Let me know if I missed any of your requirements.
You start with
\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{classname}[2009/02/24]
\LoadClass{article}
and add any customizations after that.
UPDATE: I recommend you to read LaTeX2e for class and package writers: PDF, HTML. The examples in Section 3 (The structure of a class or package) should be helpful.
A couple of points that might be interesting:
You can redefine the margins in the header (i.e. before \begin{document}} by reseting the controlling lengths like \setlength{\textwidth}{6.80in}, \setlength{\oddsidemargin}{0.0in} and so on.
\section*{...} will give you un-numbered sections already. Likewise for \subsection* and \subsubsection*. If you do use this trick and also want working references, you might have a look at How do I emit the text content of a reference in LaTeX?.
Have you looked at the titlepage environment?
But perhaps most important, the memoir class may give you all the control you need without any class hacking. Check out the documentation.
Or use Can Berk Güder's suggestion.
Related
Good morning!
I've been searching for a time but I can't reach a solution to my problem. I'm writing my master thesis, and I want to add custom words to my references, I mean, if I want to ref the only table in my document (\label{table:test} for example), I usually do \ref{table:test}, getting as a result just a clickable number 1.
However, I need to set a global option in order to, always I refer to a table, for example, I get {custom word} 1(1 for the first table). This custom word surely will be Table, but I can desire to use Figure(in English) or Imagen (in spanish), for ref figures.
Thanks you very much in advance!
The cleveref package will automatically add the correct words and adapt to the language of your document:
\documentclass[spanish]{article}
\usepackage{babel}
\usepackage{hyperref}
\usepackage[noabbrev,nameinlink]{cleveref}
\begin{document}
\begin{figure}
\caption{content...}
\label{key}
\end{figure}
\cref{key}
\end{document}
I'm designing my diploma thesis and would like to make a big question mark to every problem and a exclamation mark to every solution. It should like like this:
Do you know any Latex-Libraries to accomplish that behaviour? If there is no such library I would be more than happy if you could help me getting started writing my own Latex-Command.
Here is one basic approach. No packages are involved.
A particular thing about your layout is the use of the margin, correlated with that line of text. One way about it is to define a simple environment, which uses Latex command for margin notes, \marginpar. Then you can also set up fonts as you please, within this environment. Below I also insert an unrelated margin note, as an example in case you are not familiar with those.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\newenvironment{Q} {\hspace{\stretch{1}} \Huge} {\marginpar{ \Huge{?} } \newline}
\newenvironment{A} {\hspace{\stretch{1}} \Huge} {\marginpar{ \Huge{!} } \newline}
\begin{document}
\section{First section}
Some text ... Margin note entered {\em here} \marginpar{NOTE} ... more text \\
\vspace{0.5in}
\begin{Q} Here is a question \end{Q}
State your question ... \\
\begin{A} This is an answer \end{A}
Go with the answer ... \\
New paragraph, for other text ...
\end{document}
See this page in Latex Wikibooks for a very clear explanation of how to define a new environment. If you end up wanting more control see the package environ.
Margin notes provide you with a few options. If you want to reverse the logic of where they are placed, use \reversemarginpar. You can also set up different text to appear depending on which margin the note goes in by using \marginpar[left text]{right text}. See the Wikibooks article on footnotes and margin notes, which spells out where notes go based on the document type.
Here are some posts for more specialized uses: on notes in both margins, and on notes in narrow margnins. For doing far more with margin notes see package magrinnote, and there are yet other packages, like todonotes. See this post for a visual show off of what it can do.
I've used a basic way to change font size, and no special symbols. A list of these fonts can be found in this post, for example. You can use very particular fonts and/or symbols if you like, which are convenient to set up in the new environment. See, for example, this post, which also has another way of formatting for your Q&A. Also informative may be this post.
Note that you can also use existing environments inside this new one, if you wish. You can also set up a counter, and have an ability to cross-reference these. See this post for an example.
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've checked the Beamer Class manual (PDF file).
I can't figure out how to change the indentation bullet assigns to \itemize.
[This is kind of important, as I'm using 2 column slides, and I don't want beamer to steal too much horizontal space].
Beamer just delegates responsibility for managing layout of itemize environments back to the base LaTeX packages, so there's nothing funky you need to do in Beamer itself to alter the apperaance / layout of your lists.
Since Beamer redefines itemize, item, etc., the fully proper way to manipulate things like indentation is to redefine the Beamer templates. I get the impression that you're not looking to go that far, but if that's not the case, let me know and I'll elaborate.
There are at least three ways of accomplishing your goal from within your document, without mussing about with Beamer templates.
With itemize
In the following code snippet, you can change the value of \itemindent from 0em to whatever you please, including negative values. 0em is the default item indentation.
The advantage of this method is that the list is styled normally. The disadvantage is that Beamer's redefinition of itemize and \item means that the number of paramters that can be manipulated to change the list layout is limited. It can be very hard to get the spacing right with multi-line items.
\begin{itemize}
\setlength{\itemindent}{0em}
\item This is a normally-indented item.
\end{itemize}
With list
In the following code snippet, the second parameter to \list is the bullet to use, and the third parameter is a list of layout parameters to change. The \leftmargin parameter adjusts the indentation of the entire list item and all of its rows; \itemindent alters the indentation of subsequent lines.
The advantage of this method is that you have all of the flexibility of lists in non-Beamer LaTeX. The disadvantage is that you have to setup the bullet style (and other visual elements) manually (or identify the right command for the template you're using). Note that if you leave the second argument empty, no bullet will be displayed and you'll save some horizontal space.
\begin{list}{$\square$}{\leftmargin=1em \itemindent=0em}
\item This item uses the margin and indentation provided above.
\end{list}
Defining a customlist environment
The shortcomings of the list solution can be ameliorated by defining a new customlist environment that basically redefines the itemize environment from Beamer but also incorporates the \leftmargin and \itemindent (etc.) parameters. Put the following in your preamble:
\makeatletter
\newenvironment{customlist}[2]{
\ifnum\#itemdepth >2\relax\#toodeep\else
\advance\#itemdepth\#ne%
\beamer#computepref\#itemdepth%
\usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%
\usebeamercolor[fg]{itemize/enumerate \beameritemnestingprefix body}%
\usebeamertemplate{itemize/enumerate \beameritemnestingprefix body begin}%
\begin{list}
{
\usebeamertemplate{itemize \beameritemnestingprefix item}
}
{ \leftmargin=#1 \itemindent=#2
\def\makelabel##1{%
{%
\hss\llap{{%
\usebeamerfont*{itemize \beameritemnestingprefix item}%
\usebeamercolor[fg]{itemize \beameritemnestingprefix item}##1}}%
}%
}%
}
\fi
}
{
\end{list}
\usebeamertemplate{itemize/enumerate \beameritemnestingprefix body end}%
}
\makeatother
Now, to use an itemized list with custom indentation, you can use the following environment. The first argument is for \leftmargin and the second is for \itemindent. The default values are 2.5em and 0em respectively.
\begin{customlist}{2.5em}{0em}
\item Any normal item can go here.
\end{customlist}
A custom bullet style can be incorporated into the customlist solution using the standard Beamer mechanism of \setbeamertemplate. (See the answers to this question on the TeX Stack Exchange for more information.)
Alternatively, the bullet style can just be modified directly within the environment, by replacing \usebeamertemplate{itemize \beameritemnestingprefix item} with whatever bullet style you'd like to use (e.g. $\square$).
I use the package enumitem. You may then set such margins when you declare your lists (enumerate, description, itemize):
\begin{itemize}[leftmargin=0cm]
\item Foo
\item Bar
\end{itemize}
Naturally, the package provides lots of other nice customizations for lists (use 'label=' to change the bullet, use 'itemsep=' to change the spacing between items, etc...)
Setting \itemindent for a new itemize environment solves the problem:
\newenvironment{beameritemize}
{ \begin{itemize}
\setlength{\itemsep}{1.5ex}
\setlength{\parskip}{0pt}
\setlength{\parsep}{0pt}
\addtolength{\itemindent}{-2em} }
{ \end{itemize} }
To set the indentation globally, without using enumitem (which doesn't work on Beamer),
put the following in your preamble:
\setlength{\leftmargini}{0.5cm}
\setlength{\leftmarginii}{0.5cm}
leftmargini and leftmarginii change the first and second list level, respectively.
This solution was given here.
Like Geoff's answer, I found a solution I like using enumitem. Set defaults with \setlist[⟨names⟩,⟨levels⟩]{⟨keys/values⟩} to inherit existing (theme?) attributes or \setlist*[⟨names⟩,⟨levels⟩]{⟨keys/values⟩} to fully reset. See the enumitem documentation.
The following sets indentation for the first four levels of nested lists as well as explicitly declares labels. The labels here defaults to bullets for itemized lists and arabic numbers for enumerated lists. It then resets the default labels for nested lists; long-hyphen for 2nd itemized, single hyphen for third itemized, etc. The last line resets default label for 2nd level itemized enumerated lists to be alphabetic (a, b, c).
\usepackage{enumitem}
\setlist[1]{leftmargin=0em}
\setlist[2]{leftmargin=2em} %list within a list
\setlist[3]{leftmargin=2.5em} %list within a list within a list
\setlist[4]{leftmargin=3em}
\setlist[itemize]{label=\textbullet}
\setlist[itemize,2]{label={--}}
\setlist[itemize,3]{label={-}}
\setlist[itemize,4]{label={\textperiodcentered}}
\setlist[enumerate]{label={\arabic*}}
\setlist[enumerate,2]{label={\alph*}}
With enumitem you can also declare a specific label or spacing for a particular instance by adding the options e.g. \begin{itemize}[label={*}] This is Geoff's answer.
I'm just learning latex, so this may be trivial to some of you.
I went through a few tutorials but they all seem to cover the same things.
I'm writing a big report - calculation all the way (and it has to be neat, because it's part of the documentation). It consists of a frame around the page (15mm margins), and 3 columns inside it: in the left column (3cm wide) are references from where the equation came from (e.g. "ABS 3-2-7"), in the middle is the calculation and in the right is the accepted value (5cm wide). It is a standard way of doing things, so I don't have a choice over the layout.
Now, I don't understand, how would I go in creating such layout ? The frame with columns has to appear on every page. How to accomplish that ?
I've never seen such a document so I'm not sure how to ease the creation.
And second, how do I rename things that are in english language in document classes ? For example, "article" class, I have "References" and I need to have "Literatura".
Is there a way to rename it without touching .cls file?
For your first problem, look at the longtable package (available at ctan.org if you haven't already got it installed)
The problem with using tabular is it won't work as you want across pages.
As far as the second problem, it will depend on the environment and the document type, but typically you'll have to renew a command.
For example, add to the preamble \renewcommand\refname{Literatura} for the article class to do what you were asking for. If I recall correctly it is bibname for books.
Table design in LaTeX has not been made very easy. I would use tabbing rather than tabular and draw the lines manually to keep things simple. A downside is that you don't get any automatic sizing of the table cells, but since your format is fixed, I would consider it a good thing (i.e., if text overflows, you notice it and get to fix it yourself, and your table doesn't accidentally get stretched into the margins). If you use multiple tables like this in your document, try packaging the commands with \newenvironment.
\documentclass{article}
\usepackage[margin=15mm]{geometry}
\usepackage{amsmath}
\usepackage{calc}
\newlength{\tableheight}
\setlength{\tableheight}{20cm} % how high to draw the lines of the table
\newlength{\rulethickness}
\setlength{\rulethickness}{1pt} % how thick lines to draw
\newcommand{\verticalline}{\smash{\rule[-\tableheight]{\rulethickness}{\tableheight}}}
\newlength{\myindent}
\setlength{\myindent}{3mm} % how much to indent each column
\newlength{\leftcolumn}
\setlength{\leftcolumn}{3cm-\myindent}
\newlength{\midcolumn}
\setlength{\midcolumn}{\textwidth-3cm-5cm-\myindent-\rulethickness}
\newlength{\rightcolumn}
\setlength{\rightcolumn}{5cm-\myindent}
\begin{document}
\begin{tabbing}
% first set the tab stops
\hspace*{\myindent}\=\hspace{\leftcolumn}\=%
\hspace{\myindent}\=\hspace{\midcolumn}\=%
\hspace{\myindent}\=\hspace{\rightcolumn}\=\kill
% then draw the lines
\rule{\textwidth}{\rulethickness}\\[-\baselineskip]
\smash{\rule[-\tableheight]{\textwidth}{\rulethickness}}\\[-\baselineskip]
\verticalline\>\>\verticalline\>\>\verticalline\>\>\verticalline\\
% Now start the table: indent the first column with \>
\>ABS 3--2--7
% ... and each additional column with \>\>
\>\> $\iint_{-\infty,-\infty}^{\infty,\infty} e^{-x^2-y^2}\, dx\,dy$
\>\> 2.507
% End each line with \\, add e.g. [2pt] to get 2pt extra space if required
\\[2pt]
% here's another line:
\>ABS 3--2--8 \>\> $\displaystyle\sum_{k=0}^n k^2$ \>\> $\frac12 n(n+1)$ \\
% etc. Be careful not to overflow the table - there's no automatic check for that.
\end{tabbing}
\newpage % also remember to start a new page after the table
\end{document}
To change the fixed names, see this FAQ, or possibly this one if you are using babel.
In this case you probably want to use the tabular environment to generate the three columns (or as simon notes longtable if your report-thingy runs longer than one page). Something like:
\framebox{
\centering
\begin{tabular}{p{3cm}|p{\specialwidth}|p{5cm}}
Ref 1-0-0 & 1.2345 & 1.2346 \\
Ref 1-0-1 & 2.3456 & 2.3454 \\
...
\end{tabular}
}
You'll note that I've used paragraph formatted columns (the p{<length>} formatting specifiers), and stuck a frame around it with \framebox.
You can either compute \specialwidth by hand, or calculate it:
\newlength{\specialwidth}
\setlength{\specialwidth}{\textwidth}
\addtolength{\specialwidth}{-10cm} % extra room for the seperators...
I can't help you on the internationalization issue...