Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I want to make cheat sheets for my personal use. I want to use this opportunity to get a good hand on LaTeX too. (I am already comfortable making simple documents math related in LaTeX.)
Now I want to try making cheat sheets in LaTeX. But I don't know how to do it. In cheat sheets, usually the page is split into multiple rectangular sections and each one has a few commands or notes inside it. Each rectangular section has a border etc.
How can it be done in LaTeX? Are any packages available to do this? Do you think TikZ will be a good idea for this?
Because some professors allowed us to use cheat sheets written on a computer for exams, I decided to create a template some time ago to save enough space as possible but keep readibility. The template uses the code of the answer here.
Update: The complete source code can now be found here.
The base file looks like this:
\documentclass[10pt,landscape,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{tikz}
\usetikzlibrary{shapes,positioning,arrows,fit,calc,graphs,graphs.standard}
\usepackage[nosf]{kpfonts}
\usepackage[t1]{sourcesanspro}
%\usepackage[lf]{MyriadPro}
%\usepackage[lf,minionint]{MinionPro}
\usepackage{multicol}
\usepackage{wrapfig}
\usepackage[top=0mm,bottom=1mm,left=0mm,right=1mm]{geometry}
\usepackage[framemethod=tikz]{mdframed}
\usepackage{microtype}
\let\bar\overline
\definecolor{myblue}{cmyk}{1,.72,0,.38}
\def\firstcircle{(0,0) circle (1.5cm)}
\def\secondcircle{(0:2cm) circle (1.5cm)}
\colorlet{circle edge}{myblue}
\colorlet{circle area}{myblue!5}
\tikzset{filled/.style={fill=circle area, draw=circle edge, thick},
outline/.style={draw=circle edge, thick}}
\pgfdeclarelayer{background}
\pgfsetlayers{background,main}
\everymath\expandafter{\the\everymath \color{myblue}}
\everydisplay\expandafter{\the\everydisplay \color{myblue}}
\renewcommand{\baselinestretch}{.8}
\pagestyle{empty}
\global\mdfdefinestyle{header}{%
linecolor=gray,linewidth=1pt,%
leftmargin=0mm,rightmargin=0mm,skipbelow=0mm,skipabove=0mm,
}
\newcommand{\header}{
\begin{mdframed}[style=header]
\footnotesize
\sffamily
Cheat sheet\\
by~Your~Name,~page~\thepage~of~2
\end{mdframed}
}
\makeatletter
\renewcommand{\section}{\#startsection{section}{1}{0mm}%
{.2ex}%
{.2ex}%x
{\color{myblue}\sffamily\small\bfseries}}
\renewcommand{\subsection}{\#startsection{subsection}{1}{0mm}%
{.2ex}%
{.2ex}%x
{\sffamily\bfseries}}
\def\multi#column#out{%
\ifnum\outputpenalty <-\#M
\speci#ls \else
\ifvoid\colbreak#box\else
\mult#info\#ne{Re-adding forced
break(s) for splitting}%
\setbox\#cclv\vbox{%
\unvbox\colbreak#box
\penalty-\#Mv\unvbox\#cclv}%
\fi
\splittopskip\topskip
\splitmaxdepth\maxdepth
\dimen#\#colroom
\divide\skip\footins\col#number
\ifvoid\footins \else
\leave#mult#footins
\fi
\let\ifshr#kingsaved\ifshr#king
\ifvbox \#kludgeins
\advance \dimen# -\ht\#kludgeins
\ifdim \wd\#kludgeins>\z#
\shr#nkingtrue
\fi
\fi
\process#cols\mult#gfirstbox{%
%%%%% START CHANGE
\ifnum\count#=\numexpr\mult#rightbox+2\relax
\setbox\count#\vsplit\#cclv to \dimexpr \dimen#-1cm\relax
\setbox\count#\vbox to \dimen#{\vbox to 1cm{\header}\unvbox\count#\vss}%
\else
\setbox\count#\vsplit\#cclv to \dimen#
\fi
%%%%% END CHANGE
\set#keptmarks
\setbox\count#
\vbox to\dimen#
{\unvbox\count#
\remove#discardable#items
\ifshr#nking\vfill\fi}%
}%
\setbox\mult#rightbox
\vsplit\#cclv to\dimen#
\set#keptmarks
\setbox\mult#rightbox\vbox to\dimen#
{\unvbox\mult#rightbox
\remove#discardable#items
\ifshr#nking\vfill\fi}%
\let\ifshr#king\ifshr#kingsaved
\ifvoid\#cclv \else
\unvbox\#cclv
\ifnum\outputpenalty=\#M
\else
\penalty\outputpenalty
\fi
\ifvoid\footins\else
\PackageWarning{multicol}%
{I moved some lines to
the next page.\MessageBreak
Footnotes on page
\thepage\space might be wrong}%
\fi
\ifnum \c#tracingmulticols>\thr##
\hrule\allowbreak \fi
\fi
\ifx\#empty\kept#firstmark
\let\firstmark\kept#topmark
\let\botmark\kept#topmark
\else
\let\firstmark\kept#firstmark
\let\botmark\kept#botmark
\fi
\let\topmark\kept#topmark
\mult#info\tw#
{Use kept top mark:\MessageBreak
\meaning\kept#topmark
\MessageBreak
Use kept first mark:\MessageBreak
\meaning\kept#firstmark
\MessageBreak
Use kept bot mark:\MessageBreak
\meaning\kept#botmark
\MessageBreak
Produce first mark:\MessageBreak
\meaning\firstmark
\MessageBreak
Produce bot mark:\MessageBreak
\meaning\botmark
\#gobbletwo}%
\setbox\#cclv\vbox{\unvbox\partial#page
\page#sofar}%
\#makecol\#outputpage
\global\let\kept#topmark\botmark
\global\let\kept#firstmark\#empty
\global\let\kept#botmark\#empty
\mult#info\tw#
{(Re)Init top mark:\MessageBreak
\meaning\kept#topmark
\#gobbletwo}%
\global\#colroom\#colht
\global \#mparbottom \z#
\process#deferreds
\#whilesw\if#fcolmade\fi{\#outputpage
\global\#colroom\#colht
\process#deferreds}%
\mult#info\#ne
{Colroom:\MessageBreak
\the\#colht\space
after float space removed
= \the\#colroom \#gobble}%
\set#mult#vsize \global
\fi}
\makeatother
\setlength{\parindent}{0pt}
\begin{document}
\small
\begin{multicols*}{5}
\input{section1}
\end{multicols*}
\end{document}
When you use the code copy the template and put your LaTeX code in external files like section1.tex, section2.tex,.... Than you can easily follow the normal structure inside these LaTeX files like
\section{Title of section 1}
\subsection*{Title of subsection 1}
Some text...
\subsection*{Title of subsection 2}
With some colored math $\sum_{i=1}^\infty i$.
Inserting an image also works:\\
\includegraphics[width=\linewidth]{yourimage.png}
After filling your sections you'll get a much compressed document which still looks good like this:
I've been making my own cheat sheets as well for various things. I really like how the Latex cheat sheet found here looks. I suggest grabbing the tex source and stealing some ideas from it :).
Consider using multicol.
And consider familiarizing yourself with CTAN. Most things TeX end up there sooner or later, though it does require some digging if you don't know what you're looking for.
Here is a beautiful example of a cheat sheet (is a booklet actually, not just a couple of pages).
http://clqr.boundp.org/index.html
It is made using LaTex. It summarizes all the symbols on the Common Lisp Standard. Maybe you can pick up one or two tips from the available LaTeX source.
I like how these cheat sheets look like:
http://michaelgoerz.net/refcards/
Related
I have searched but nothing useless, only "use \newline" or "use \".
I'm creating a simple latex document to store any texts instead of using .txt, and the problem is that the pdf document contains the lines going towards right until they go out of the paper.
I'm using this simple code
\documentclass[a4paper]{article}
\usepackage{geometry}
\geometry{
a4paper,
total={170mm,257mm},
left=5mm,
top=20mm,
}
\begin{document}
\section{Text 1}
Loremipsumdolorsitamet,consecteturadipiscingelit,seddoeiusmodtemporincididuntutlabore etdoloremagnaaliqua.Utenimadminimveniam,quisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequat.Duisauteiruredolorinreprehenderitinvoluptatevelitessecillum doloreeufugiatnullapariatur.Excepteursintoccaecatcupidatatnonproident,suntinculpaquiofficiadeseruntmollitanimidestlaborum.
\end{document}
Since latex sees it as a one word, it refuses to break it since it doenst know its hyphenation. But I would like to allow latex to break it regardless. Any thoughts ?
Remarks: I already have used:
\hspace{0pt}
\leavevmode\nobreak\hspace{0pt}
\mbox{Loremip...larorum.}
Nothing worked.
I think I got why nothing worked. See my code below, that I managed to compile successfully after editing your MWE.
You basically have two ways to force hyphenation here.
As in the comment by SamCarter, you manually split words within text, just using \- where necessary. I did it below in line 18 (6 from bottom).
You add to your preamble the command \hyphenation{word-to-split}: I did this below to hyphenate the word in line 20 (4 from bottom). Notice that, in this case, you use - instead of \- within the braces {} enclosing the argument.
\documentclass[a4paper]{article}
\usepackage{geometry}
\geometry{
a4paper,
total={170mm,257mm},
left=5mm,
top=20mm,
}
\hyphenation{Duisauteiruredolorinre-prehenderitinvoluptatevelitesse-cillum doloreeufugiatnullapariatur}
\begin{document}
\section{Text 1}
Loremipsumdolorsitamet, consecteturadipiscingelit,
seddoeiusmodtemporincididuntutlaboreetdoloremagna.
Uten\-imadminimveniam,
quisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequat.
Duisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeufugiatnullapariatur.
Excepteursintoccaecatcupidatatnonproident,
suntinculpaquiofficiadeseruntmollitanimidestlaborum.
\end{document}
Finally, if the full stop character . is not followed by a space, two separate words may be interpreted as one and the command \hyphenation may not work as expected. Not sure that this was the detail making you write that nothing worked, but be careful to this too.
For some days I am trying to solve the following problem for which I wasn't able to find a solution. Help is very much appreciated.
I am writing a long document and for some sections I would like to print a subset of items from the total bibliography that will be included at the very end before the appendix.
Is there a way do this? I was playing with refsection and imagining something like:
\documentclass[ twoside,openright,titlepage,numbers=noenddot,
headinclude,footinclude,
cleardoublepage=empty,abstract=on,
BCOR=5mm,paper=a4,fontsize=11pt
]{scrreprt}
\usepackage{biblatex}
\addbibresource[label=ownpubs]{ownpubs.bib}
\addbibresource[label=refs]{references.bib}
\begin{document}
%here I want to print a selection of the complete bibliography
%References are required to be consistent throughout the whole document
\chapter*{Related Publications}
\begin{refsection}[references.bib]
\nocite{*}
\printbibliography[heading=none]
\end{refsection}
%here goes all the other stuff: chapters, sections, whatever
%print complete bibliography
\nocite{*}
\printbibliography
\end{document}
ownpubs.bib:
#article{einstein1935can,
title={Can quantum-mechanical description of physical reality be considered complete?},
author={Einstein, Albert and Podolsky, Boris and Rosen, Nathan},
journal={Physical review},
volume={47},
number={10},
pages={777},
year={1935},
publisher={APS}
}
#article{einstein1905movement,
title={On the movement of small particles suspended in stationary liquids required by the molecularkinetic theory of heat},
author={Einstein, A},
journal={Ann. d. Phys},
volume={17},
number={549-560},
pages={1},
year={1905}
}
references.bib:
#article{schrodinger1935gegenwartige,
title={Die gegenw{\"a}rtige Situation in der Quantenmechanik},
author={Schr{\"o}dinger, Erwin},
journal={Naturwissenschaften},
volume={23},
number={50},
pages={844--849},
year={1935},
publisher={Springer-Verlag}
}
With the above code I got the bibliographies printed, but the references (numbers) are not consistent.
Does anyone know a way to approach this problem? I am in no means restricted to splitting the files up. That was just the only solution I was able to come up with.
Thanks for your help and warm Greetings!
You could use a similar approach as in https://tex.stackexchange.com/a/166018 and automatically add some keyword to all entries in references.bib. This will allow you to filter for those when using \printbibliography:
\documentclass[ twoside,openright,titlepage,numbers=noenddot,
headinclude,footinclude,
cleardoublepage=empty,abstract=on,
BCOR=5mm,paper=a4,fontsize=11pt
]{scrreprt}
\usepackage{biblatex}
\addbibresource[label=ownpubs]{ownpubs.bib}
\addbibresource[label=refs]{references.bib}
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map[overwrite]{
\perdatasource{references.bib}
\step[fieldset=keywords, fieldvalue={,Perhalo}, append]
}
}
}
\begin{document}
%here I want to print a selection of the complete bibliography
%References are required to be consistent throughout the whole document
\chapter*{Related Publications}
\printbibliography[heading=none,keyword={Perhalo}]
%here goes all the other stuff: chapters, sections, whatever
%print complete bibliography
\nocite{*}
\printbibliography
\end{document}
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 7 years ago.
Improve this question
I have a report with appendixes.
What I want is to use a different style on the page numbering when the appendixes start.
I use Arabic numbering until I reach the appendixes. Then I would want to do something like this:
I want the custom page numbering to be:
Chapter: A
Section: {Chapter}{1} (A-1)
\newpage
\pagenumbering{custompagenumbering}
Is this possible?
Some paragraph. Some paragraph. Some paragraph. Some paragraph. Some paragraph.
\newpage
\setcounter{page}{1}
\renewcommand{\thepage}{A-\arabic{page}}
Some paragraph. Some paragraph. Some paragraph. Some paragraph. Some paragraph.
Would this be anywhere near what you want to do? This is how you can manipulate the page counter, and the \thepage command that determines what will be printed as page number. \roman{page} would give roman numbers, \alph{page} a, b, c ...
The other sensible solution is to use the fancyhdr package, as suggested before.
First I would create one file that includes all chapters and appendixes etc. something called main.tex or thesis.tex
there you can do all the includes and document settings, and also your header and footer settings:
% Free Header and Footer
\usepackage{fancyhdr}
\lfoot[\fancyplain{}{}]{\fancyplain{}{}}
\rfoot[\fancyplain{}{}]{\fancyplain{}{}}
\cfoot[\fancyplain{}{\footnotesize\thepage}]{\fancyplain{}{\footnotesize\thepage}}
\lhead[\fancyplain{}{\footnotesize\nouppercase\leftmark}]{\fancyplain{}{}}
\chead{}
\rhead[\fancyplain{}{}]{\fancyplain{}{\footnotesize\nouppercase\sc\leftmark}}
here it would make the page number in the center of your page foot. and the chapter title on the left of your header and also on the right if your work is doubel paged.
then you can start to include your other chapters.. mine looks like that (still in thesis.tex):
% --- Start of Document ----------------------------------------
\begin{document}
\pagenumbering{roman} %roemische ziffern
\pagestyle{fancy} % Initialize Header and Footer
\include{title} % Title Page
\include{affidavit} % affidavit
\include{abstracts} % Englisch and German abstracts
\include{acknowl} % Acknowledgements
\include{glossary} % Glossary
\include{abbreviation} % Abkuerzungen
%\include{keywords} % Keywords
\include{toc} % Table of Contents
%--- Include your chapters here ----------
\setcounter{page}{1} % set page to 1 again to start arabic count
\pagenumbering{arabic}
%\include{chapter0}
\include{chapter1} % Introduction
\include{chapter2} % Background
\include{chapter3} % Konzeption
\include{chapter4} % Technische Umsetzung
\include{chapter5}
\include{chapter6}
%
%% ....
\appendix
\include{appendix} % Appendix A
\end{document}
Hope that helps! headers and footers are some time difficult, and sometime if you change \documentclass it could appear different too. ;)
If you're able to use the Memoir class (which I recommend), you can use page styles. See Chapter 7.2 Page Styles. For example, create two styles:
\pagestyle{plain} % Regular page numbering
... STUFF ...
\clearpage % make a new page numbering down here
\copypagestyle{AppendixPS}{plain}
\renewcommand{\thepage}{Chapter \chapter Section \section page \page}
\pagestyle{AppendixPS}
I haven't tested this – or used LaTeX to do this in a while – but I hope it provides some food for thought or at least puts you onto the right track.
This question already has answers here:
How to have no pagebreak after \include in LaTeX
(5 answers)
Closed 8 years ago.
I am in the progress of writing an expose for my master thesis. One point in the expose is an overview of literature. To save my time and work I use bibtex to create that chapter. The thing I want to change now is that latex starts a new page for the bibliography which is an enormous overhead in a four page document.
The, I think, relevant parts from my document are:
\documentclass [ fontsize = 12pt,
paper = a4,
paper = portrait,
twoside = false,
headsepline,
twocolumn = false,
numbers=noenddot
]{scrartcl}
\bibliographystyle{unsrt}
\begin{document}
%
\include{text}
\nocite{*}
\singlespacing
\bibliography{literature}
%
\end{document}
I am using biblatex. This solved the problem:
\begingroup
\let\clearpage\relax
\printbibliography
\endgroup
How to make word 'appendix' appear in the table of contents? Right now toc looks like this:
1 ......
2 ......
.
.
A .....
B .....
I would like it to be:
1 ......
2 ......
.
.
Appendix A .....
Appendix B .....
My latex source file structure is like this:
\begin{document}
\tableofcontents
\include{...}
\include{...}
\appendix
\include{...}
\include{...}
\end{document}
There's a couple of ways to solve this problem; unfortunately, I've only got a hack for you at this stage. One problem is that if we redefine the section number "A" to include the word "Appendix", it messes up the formatting of the table of contents. So instead, I've just defined a new sectioning command that prints the section without a number and inserts "Appendix X" manually.
Kind of ugly, but at least it works without having to change any markup :)
\documentclass{article}
\makeatletter
\newcommand\appendix#section[1]{%
\refstepcounter{section}%
\orig#section*{Appendix \#Alph\c#section: #1}%
\addcontentsline{toc}{section}{Appendix \#Alph\c#section: #1}%
}
\let\orig#section\section
\g#addto#macro\appendix{\let\section\appendix#section}
\makeatother
\begin{document}
\tableofcontents
\section{goo}
\label{a}
This is sec~\ref{a}
\section{har}
\label{b}
This is sec~\ref{b}
\appendix
\section{ji}
\label{c}
This is app~\ref{c}
\subsection{me}
does this look right?
\end{document}
For my thesis, I did the following:
\appendix
\addcontentsline{toc}{section}{Appendix~\ref{app:scripts}: Training Scripts}
\section*{Sample Training Scripts}
\label{app:scripts}
Blah blah appendix content blah blah blah.
Explanation: I manually added a line to the TOC so I would have "Appendix X:..." show up in my TOC. Then I excluded the actual section command from the TOC by using an asterisk.
This is probably most easily achieved by using the appendix
package, or the memoir class.
If you don't want to use a prepackaged solution, you'll have to
hack the sectioning commands. When I needed to do this for my
dissertation, I cloned the report class, and edited until I made
the margins lady happy. What you're looking for is the
definition of the \addcontentsline macro.
The appendix package is really good and simple solution. My answer can be helpful for who wants to change chapters numbering style, for example, with using cyrillic alphabet or roman digits. The appendices numbering style is hardcoded in the \#resets#pp command (I looked in sources here http://hal.in2p3.fr/docs/00/31/90/21/TEX/appendix.sty). I solved it by simple redefining this command to my own. Just add this code into your preamble:
\makeatletter
\renewcommand{\#resets#pp}{\par
\#ppsavesec
\stepcounter{#pps}
\setcounter{section}{0}
\if#chapter#pp
\setcounter{chapter}{0}
\renewcommand\#chapapp{\appendixname}
\gdef\thechapter{\Asbuk{chapter}} % changed
\else
\setcounter{subsection}{0}
\gdef\thechapter{\Asbuk{section}} % changed
\fi
\if#pphyper
\if#chapter#pp
\renewcommand{\theHchapter}{\theH#pps.\Asbuk{chapter}} % changed
\else
\renewcommand{\theHsection}{\theH#pps.\Asbuk{section}} % changed
\fi
\def\Hy#chapapp{\appendixname}%
\fi
\restoreapp
}
\makeatother
As a result,
Appendix A
Appendix B
Appendix C
...
will change to
Appendix A
Appendix Б
Appendix В
... etc
I'm not a latex expert, and I can't guarantee this code won't break something else.
Based on #Will Robertson's answer, the code below defines the same thing but for chapter and also fixes the fact that chapter* does not add to the header when using the fancyhdr package.
With this in the preable all issues are resolved.
\makeatletter
\newcommand\appendix#chapter[1]{%
\refstepcounter{chapter}%
\def\app#ct{Appendix \#Alph\c#chapter: #1}
\orig#chapter*{\app#ct}%
\markboth{\MakeUppercase{\app#ct}}{\MakeUppercase{\app#ct}}
\addcontentsline{toc}{chapter}{\app#ct}%
}
\let\orig#chapter\chapter
\g#addto#macro\appendix{\let\chapter\appendix#chapter}
\makeatother