LaTeX/Teme

Izvor: Викикњиге

LaTeX

Početak
  1. Uvod100% završen  Dec 13, 2015
  2. Instalacija100% završen  Dec 13, 2015
  3. Instalacija dodatnih paketa 100% završen  Dec 13, 2015
  4. Osnove 100% završen  Dec 13, 2015
  5. Kako pronaći pomoć 100% završen  Dec 13, 2015

Zajednički elementi

  1. Struktura dokumenta 100% završen  Dec 28, 2015
  2. Formatiranje teksta 100% završen  Dec 27, 2015
  3. Formatiranje paragrafa 100% završen  Jan 02, 2016
  4. Boje 100% završen  Jan 10, 2016
  5. Slova100% završen  Jan 10, 2016
  6. Struktura listi 100% završen  Jan 10, 2016
  7. Posebni znakovi 100% završen  Jan 10, 2016
  8. Internacionalizacija 100% završen  Jan 10, 2016
  9. Rotacija 100% završen  Jan 10, 2016
  10. Tabele 100% završen  Jan 10, 2016
  11. Stvaranje naslova 100% završen  Jan 10, 2016
  12. Raspored strane 100% završen  Jan 10, 2016
  13. Uvoz grafike 100% završen  Jan 10, 2016
  14. Figure i natpisi100% završen  Jan 10, 2016
  15. Fusnote i Margine100% završen  Jan 10, 2016
  16. Hiperlinkovi 100% završen  Jan 10, 2016
  17. Oznake i referenciranje100% završen  Jan 10, 2016

Mehanika

  1. Greške i upozorenja 75% završen  Jan 02, 2016
  2. Dužine 100% završen  Jan 02, 2016
  3. Brojači 100% završen  Jan 02, 2016
  4. Kutije 100% završen  Jan 02, 2016
  5. Pravila i nosači 100% završen  Jan 02, 2016

Tehnički tekstovi

  1. Matematika100% završen  Jan 10, 2016
  2. Naprednija matematika 75% završen  Jan 10, 2016
  3. Teoreme
  4. Hemijska grafika 75% završen  Jan 02, 2016
  5. Algoritmi 75% završen  Jan 02, 2016
  6. Listiranje izvornog koda 100% završen  Jan 02, 2016
  7. Lingvistika 75% završen  Jan 02, 2016

Posebne strane

  1. Indeksiranje 75% završen  Jan 02, 2016
  2. Rečnik 75% završen  Jan 02, 2016
  3. Upravljanje bibliografijom‎ 75% završen  Jan 10, 2016
  4. Više bibliografije

Posebni dokumenti

  1. Pisma 50% završen  Jan 02, 2016
  2. Prezentacije 75% završen  Jan 02, 2016
  3. Učiteljski deo 75% završen  Jan 10, 2016
  4. Kratka biografija 50% završen  Jan 02, 2016

Kreiranje grafika

  1. Predstavljanje proceduralnih grafika 100% završen  Jan 02, 2016
  2. MetaPostovi 0% završen  Jan 02, 2016
  3. Slika 50% završen  Jan 02, 2016
  4. PGF/TikZ 25% završen  Jan 02, 2016
  5. PSTricks 50% završen  Jan 02, 2016
  6. Xy-pic 25% završen  Jan 02, 2016
  7. Pravljenje 3D grafika 75% završen  Jan 02, 2016

Programiranje

  1. Makroi 100% završen  Jan 10, 2016
  2. Običan TeH‎ 100% završen  Jan 10, 2016
  3. Kreiranje paketa 100% završen  Jan 10, 2016
  4. Teme 75% završen  Jan 10, 2016

Razno

  1. Modularni Dokumenti 100% završen  Jan 10, 2016
  2. Zajedničko pisanje LaTeX dokumenata 75% završen  Jan 10, 2016
  3. Otpremanje u druge formate 100% završen  Jan 10, 2016

Pomoć i preporuke

  1. Najčešće postavljana pitanja 100% završen  Jan 10, 2016
  2. Saveti i trikovi 75% završen  Jan 10, 2016

Dodaci

  1. Autori 0% završen  Jan 10, 2016
  2. Linkovi 0% završen  Jan 10, 2016
  3. Oznake paketa 0% završen  Jan 10, 2016
  4. Primeri LaTeX dokumenata 0% završen  Jan 10, 2016
  5. Indeks 0% završen  Jan 10, 2016
  6. Rečnik naredbi 0% završen  Jan 10, 2016

Novi korisnici LaTeX-a se osećaju razočarano zbog nedostatka vizuelnog prilagođavanja koje nudi sistem. Zapravo to je učinjeno namerno: LaTeX filozofija ima pravo na pravo formatiranje dok je pisac fokusiran na sadržaj.

U ovom poglavlju ćemo pokazati šta možemo postići sa nekim naporima.

Uvod[uredi]

U nastavku ćemo napisati temu, paket koji će samo promeniti izgled dokumenta, tako da će naš dokument raditi sa ili bez teme.

Imajte na umu da ako može izgledati dopadljivo, to apsolutno nije model tipografije. Ne treba koristiti takvu temu za ozbiljne publikacije. Ovo je više tehnološki primer pokazuju LaTeX sposobnosti.

Konfiguracija paketa[uredi]

Ovde se ništa posebno ne može reći. Ovo je direktna primena poglavlja Kreiranja paketa.

Učitaćemo sledeće pakete.

  • needspace se koristi da spreči praznu stranu odmah posle komande koja pravi odeljke.
  • tikz se koristi za crtanje materijala.

Definišemo opciju boje i može se koristiti onoliko koliko želite. Definisanje boje sa specifičnim imenima čini se vrlo fleksibilno. Takođe koristimo opciju da isključi reflektujuće efekte kojih bi moglo biti malo previše !

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{theme-fancy}[2013/01/13 v1.0 fancy theme]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Packages

\RequirePackage{geometry}
\RequirePackage{needspace}
\RequirePackage[svgnames]{xcolor}

\RequirePackage{hyperref}
\hypersetup{colorlinks=true}

\RequirePackage{fancyhdr}

\RequirePackage{tikz}
\usetikzlibrary{
  calc,
  decorations.pathmorphing,
  fadings,
  shadows,
  shapes.geometric,
  shapes.misc,
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Options

%% Toggle reflection.
\newif\if@mirrors\@mirrorsfalse
\DeclareOption{mirrors}{
  \@mirrorstrue
}

%% Colors.
\newif\if@red\@redfalse
\DeclareOption{red}{
  \@redtrue
}

\ExecuteOptions{}
\ProcessOptions\relax

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Configuration

\renewcommand{\familydefault}{\sfdefault}
\setlength{\parskip}{0.5\baselineskip}

%% Colors
\colorlet{toctitle}{DarkGray!50!black}
\colorlet{titlebg}{MidnightBlue}
\colorlet{titlefg}{LightBlue}
\colorlet{titletxt}{MidnightBlue}
\colorlet{sectionfg}{MidnightBlue}
\colorlet{subsectionfg}{SteelBlue}
\colorlet{subsubsectionfg}{LightSteelBlue!60!black}

\if@red
\colorlet{toctitle}{DarkGray!50!black}
\colorlet{titlebg}{DarkRed}
\colorlet{titlefg}{FireBrick!50}
\colorlet{titletxt}{DarkRed}
\colorlet{sectionfg}{DarkRed}
\colorlet{subsectionfg}{Crimson!50!black}
\colorlet{subsubsectionfg}{LightSteelBlue!60!black}
\fi

Zaglavlje i podnožje[uredi]

Koristimo TikZ za crtanje ispunjenog polukruga.

fancyhdr se koristi za postavljanje zaglavlja i podnožja. Vodimo računa o korišćenju fancy stila i da počnemo od nule brisanjem prethodnog zaglavlja i podnožja sa \fancyhf{}.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Header and Footer

\tikzstyle{foliostyle}=[fill=Lavender, text=MidnightBlue, inner sep=5pt, semicircle]

\pagestyle{fancy}
\fancyhf{}
\fancyfoot[C]{
  \vskip 3pt
  \begin{tikzpicture}
    \node[foliostyle]
    {\bfseries\thepage};
  \end{tikzpicture}
}

\renewcommand{\headrulewidth}{0.8pt}
\addtolength{\headheight}{\baselineskip} 
\renewcommand{\headrule}{\color{LightGray}\hrule}
\fancyhead[LE]{ \textcolor{gray}{\slshape \rightmark} } 
\fancyhead[RO]{ \textcolor{gray}{\slshape \leftmark} }

Sadržaj[uredi]

Redefinišemo komande koje koriste \tableofcontents.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Table of contents

\newcommand{\sectiontoccolor}{sectionfg}
\newcommand{\subsectiontoccolor}{subsectionfg}
\newcommand{\subsubsectiontoccolor}{subsubsectionfg}

\renewcommand*\l@section{\color{\sectiontoccolor}\def\@linkcolor{\sectiontoccolor}\@dottedtocline{1}{1.5em}{2.3em}}
\renewcommand*\l@subsection{\color{\subsectiontoccolor}\def\@linkcolor{\subsectiontoccolor}\@dottedtocline{1}{2.3em}{3.1em}}
\renewcommand*\l@subsubsection{\color{\subsubsectiontoccolor}\def\@linkcolor{\subsubsectiontoccolor}\@dottedtocline{1}{3.1em}{3.9em}}
\def\contentsline#1#2#3#4{%
  \ifx\\#4\\%
  \csname l@#1\endcsname{#2}{#3}%
  \else
  \csname l@#1\endcsname{\hyper@linkstart{link}{#4}{#2}\hyper@linkend}{%
    \hyper@linkstart{link}{#4}{#3}\hyper@linkend
  }%
  \fi
}

%% New title format -- 'section' is used by default.
\newcommand{\tocformat}[1]{{\Huge\bf#1}}

\renewcommand\tableofcontents{%
  \tocformat{
    \textcolor{toctitle}{\contentsname}
    \@mkboth{\MakeUppercase\contentsname}{\MakeUppercase\contentsname}
  }%
  \@starttoc{toc}%
}

Odeljci[uredi]

Ovo je verovatno najkomplikovaniji deo. To nije tako teško, jer je kod gotovo isti za \section, \subsection i \subsubsection.

Koristimo \needspace da se uverimo da nema prestajanja reda odmah nakon komande stvaranja odeljaka. Mi prilogđavamo komandu u grupi gde smo postavili veličinu fonta, jer prostor koji nam treba je \baselineskip što zavisi od veličine fonta.

Zvezdaste komande neće postaviti brojače (LaTeX podrazumevano ponašanje). Možete izabrati drugačije rukovanje zvezdastom komandom vraćanjem brojača na primer.

Nastavljamo odeljak štampanje od strane \noindent. Uveravamo se da je kraj štampanja odeljka sa \par komandom kojom se uveravamo da je sledeći tekst pravilno odštampan.

Za \subsection koristimo mirrors opciju koja menja izgled.

Da bi se pravilno rukovalo PDF markerima moramo pratiti sledeće redove na kraju definicija.

\phantomsection
\addcontentsline{toc}{section}{\thesection~#1}

Konačno, za \section samo želimo da odštampamo u zaglavlju, pa zovemo \sectionmark komandu. Ovde smo promenili ponašanje komande u odnosu na originalnu LaTeX verziju, pošto definišemo i koristimo \sectionmarkstar komandu.


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Section style

\renewcommand\section{
  \@ifstar
  \my@sectionstar
  \my@section
}

%% Note: to justify, text width must be set to \textwidth - 2*(inner sep).
\tikzstyle{sectionstyle}=[
  inner sep=5pt,
  text width=\textwidth-10pt,
  left color=sectionfg!100!white,
  right color=sectionfg!50!white,
  rounded corners,
  text=Ivory,
  rectangle
]

\newcommand\my@section[1]{
  \stepcounter{section}
  {\Large\needspace{\baselineskip}}
  \noindent
  \begin{tikzpicture}
    \node[sectionstyle] {\bfseries\Large\thesection\quad#1};
  \end{tikzpicture}
  \par
  \phantomsection
  \addcontentsline{toc}{section}{\thesection~#1}
  \sectionmark{#1}
}

\newcommand{\sectionmarkstar}[1]{\markboth{\MakeUppercase{#1}}{}}

\newcommand\my@sectionstar[1]{
  {\Large\needspace{\baselineskip}}
  \noindent
  \begin{tikzpicture}
    \node[sectionstyle] {\bfseries\Large#1};
  \end{tikzpicture}
  \par
  \phantomsection
  \addcontentsline{toc}{section}{#1}
  \sectionmarkstar{#1}
}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Subsection style

\renewcommand\subsection{
  \@ifstar
  \my@subsectionstar
  \my@subsection
}

\tikzstyle{subsectionstyle}=[
  left color=subsectionfg!50!white,
  right color=subsectionfg!100!white,
  text=Ivory,
  ellipse,
  inner sep=5pt
]

\newcommand\my@subsection[1]{
  \stepcounter{subsection}
  {\Large\needspace{\baselineskip}}
  \noindent  
  \begin{tikzpicture}
    \node[subsectionstyle,anchor=west] (number) at (0,0) {\bfseries\Large\thesubsection};
    \if@mirrors
    \node[above right,subsectionfg,anchor=south west] at ($(number.east)+(0.1,-0.1)$) {\large\bfseries#1};
    \node[yscale=-1, scope fading=south, opacity=0.4, above, anchor=south west, subsectionfg] at ($(number.east)+(0.1,0.1)$) {\large\bfseries#1};
    \else
    \node[above right,subsectionfg,anchor=west] at ($(number.east)+(0.1,0)$) {\large\bfseries#1};
    \fi
  \end{tikzpicture}
  \par
  \phantomsection
  \addcontentsline{toc}{subsection}{\thesubsection~#1}
}

\newcommand\my@subsectionstar[1]{
  {\Large\needspace{\baselineskip}}
  \noindent
  \begin{tikzpicture}
    \node[subsectionstyle,anchor=west] (number) at (0,0) {\bfseries\Large\phantom{1}};
    % 
    \if@mirrors
    \node[above right,subsectionfg,anchor=south west] at ($(number.east)+(0.1,-0.1)$) {\large\bfseries#1};
    \node[yscale=-1, scope fading=south, opacity=0.4, above, anchor=south west, subsectionfg] at ($(number.east)+(0.1,0.1)$) {\large\bfseries#1};
    \else
    \node[above right,subsectionfg,anchor=west] at ($(number.east)+(0.1,0)$) {\large\bfseries#1};
    \fi
  \end{tikzpicture}
  \par
  \phantomsection
  \addcontentsline{toc}{subsection}{#1}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Subsubsection style

\renewcommand\subsubsection{
  \@ifstar
  \my@subsubsectionstar
  \my@subsubsection
}

\tikzstyle{subsubsectionstyle}=[
  left color=subsubsectionfg!50!white,
  right color=subsubsectionfg!100!white,
  text=Ivory,
  shape=trapezium,
  inner sep=5pt
]

\newcommand\my@subsubsection[1]{
  \stepcounter{subsubsection}
  \noindent  
  \begin{tikzpicture}
	\node[subsubsectionstyle] (number) {\bfseries\large\thesubsubsection};
	\node[subsubsectionfg, right of=number, anchor=west] {\large\bfseries#1};
  \end{tikzpicture}
  \par
  \phantomsection
  \addcontentsline{toc}{subsubsection}{\thesubsubsection~#1}
}

\newcommand\my@subsubsectionstar[1]{
  \noindent
  \begin{tikzpicture}
	\node[subsubsectionstyle] (number) {\bfseries\large\vphantom{1}};
	\node[subsubsectionfg, right of=number, anchor=west] {\large\bfseries#1};
  \end{tikzpicture}
  \par
  \phantomsection
  \addcontentsline{toc}{subsubsection}{#1}
}

\endinput


Beleške i reference[uredi]


Prethodno: Kreiranje paketa Indeks Sledeće: Modularni Dokumenti