Text Formatting\topsep ajustment in list

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

\topsep ajustment in list

Post by svend_tveskaeg »

Hi LaTeX friends.

Take a look at the attached TeX file (and the resulting PDF file). How do I configure my

Code: Select all

\album
command in the preamble to increase the

Code: Select all

\topset
value? (Or whatever I need to do.)

As it is clearly seen in the PDF file, the vertical spacing between the "2 0’Clock Girlfriend" item and the first of the two "Tale of Two Cities, A (2008)" 'subitems' is way too small.

Thanks in advance!
Attachments
liste_musik.pdf
(53.2 KiB) Downloaded 273 times
liste_musik.tex
(3.22 KiB) Downloaded 249 times
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

magicmoose
Posts: 90
Joined: Fri Nov 06, 2009 7:29 am

\topsep ajustment in list

Post by magicmoose »

Hi, does this work as you want?

Code: Select all

\usepackage{ifthen}
%%%%%%%%%%%%%%%%%
%%             %%
%%   Makroer   %%
%%             %%
%%%%%%%%%%%%%%%%%


% Letter notationen.
\newcommand{\nsn}[1]{\newstylenums{#1}}

\newcounter{bandoralbum}

% Brugerdefineret liste.
\newcommand{\band}[2]{%
  \item \fontsize{12pt}{12pt} \selectfont \textsf{\href{#1}{#2}\setcounter{bandoralbum}{1}}%
}
\newcommand{\album}[3]{%
  \begin{enumerate}%
    \setlength{\parskip}{-12pt}%
		\ifthenelse{\equal{\value{bandoralbum}}{1}}{\vspace{2ex}}{}
    \item \fontsize{12pt}{12pt} \selectfont \textsf{\href{#1}{#2}~(#3)}%
		\setcounter{bandoralbum}{0}
  \end{enumerate}%
}
You can change the space between the band and start of the album line by changing the amount of vspace in the line: \ifthenelse{\equal{\value{bandoralbum}}{1}}{\vspace{2ex}}{}

hope that helps
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Re: \topsep ajustment in list

Post by svend_tveskaeg »

This is awesome! Thank you very much!

Can you tell me what the amount of vspace is if I want it to be the same both before and after the album list, i.e., what the amount of vspace after the aforementioned list is? (I hope the question makes sense.)
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
magicmoose
Posts: 90
Joined: Fri Nov 06, 2009 7:29 am

\topsep ajustment in list

Post by magicmoose »

Yes I know what you mean... how is this?

Code: Select all

\documentclass[12pt]{article}


%%%%%%%%%%%%%%%%
%%            %%
%%   Pakker   %%
%%            %%
%%%%%%%%%%%%%%%%


% Specificerer marginer og lignende for dokumentet.
\usepackage[a4paper,hmargin={2.4cm},vmargin={2.4cm,3.6cm},headheight=14.5pt,pdftex]{geometry}

% Muliggører eget design af sidehoved og -fod.
\usepackage{fancyhdr}

% Giver mulighed for at hente diverse symboler og matematiske tegn frem.
\usepackage{amssymb}

% Giver mulighed for selv at designe lister.
%\usepackage{enumerate}
%\usepackage{paralist}

% Gør, at man kan bruge diverse farver.
\usepackage{color}

% Giver mere fleksibile makroer, når man skal definere nøgler (`keys'). (Bruges af pakken ``totcount''.)
\usepackage{xkeyval}

% Med denne pakke kan man nemt få LaTeX til at angive den sidst anvendte tæller (`counter') i eksempelvis en liste.
\usepackage{totcount}

% Gør at linkene i dokumentet bliver aktiveret.
\usepackage[colorlinks=true,urlcolor=black]{hyperref}

\usepackage{ifthen}
\usepackage{enumitem}
%%%%%%%%%%%%%%%%%
%%             %%
%%   Makroer   %%
%%             %%
%%%%%%%%%%%%%%%%%


% Letter notationen.
\newcommand{\nsn}[1]{\newstylenums{#1}}

\newcounter{bandoralbum}

% Brugerdefineret liste.
\newcommand{\band}[2]{%
  \ifthenelse{\equal{\value{bandoralbum}}{1}}{\vspace*{-\itemsep}}{}%
	\item \fontsize{12pt}{12pt} \selectfont \textsf{\href{#1}{#2}}%
	\setcounter{bandoralbum}{0}%
}
\newcommand{\album}[3]{%
  \begin{enumerate}[partopsep=-4pt]%
		\item \fontsize{12pt}{12pt} \selectfont \textsf{\href{#1}{#2}~(#3)}%
		\setcounter{bandoralbum}{1}
  \end{enumerate}%
	
}
\setlength{\labelsep}{0pt}

% Ændring af \label-symbolet i første og andet led (`nesting').
\newcommand{\ops}[1]{\textbf{\textsf{#1}}}
\newcommand{\options}[3]{\color{#1}\ops{#2}\fontsize{#3}{#3}}
\renewcommand{\labelenumi}{\options{blue}{$\maltese$}{10pt}  \quad}
\renewcommand{\labelenumii}{\options{red}{$\star$}{12pt}  \enskip}

% Fortæller (La)TeX, hvad der skal registres som `total counter'.
\regtotcounter{enumi}

% Opsætning af sidehoved og -fod.
\pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\cfoot{\thepage}


%%%%%%%%%%%%%%%%%%%%%%%%%%
%%                      %%
%%   Selve dokumentet   %%
%%                      %%
%%%%%%%%%%%%%%%%%%%%%%%%%%


\begin{document}

\begin{center}
  \Huge{\textbf{Musikliste}}
\end{center}
\vspace{1cm}

\noindent Nogle f{\aa} af de bands, af hvem jeg har musik, er ikke p{\aa} nedenst{\aa}ende liste, nemlig dem jeg kun har ``split''-albums med og hvor jeg samtidig allerede har noget musik af det andet (eller de andre) band. Forklaringen p{\aa} dette er, at jeg har lavet min liste ud fra undermapperne i min musik\-mappe, og jeg gider ikke at have det samme album liggende mere end {\'e}t enkelt sted p{\aa} harddisken.

Bandnavnene er arrangeret manuelt efter titel.
\vspace{5mm}

\begin{enumerate}
  \band{http://www.myspace.com/20clockgirlfriend}{2 0'Clock Girlfriend}
    \album{http://www.amazon.com/gp/product/B00171WXOC/}{Tale of Two Cities, A}{2008}
    \album{http://www.amazon.com/gp/product/B00171WXOC/}{Tale of Two Cities, A}{2008}
  \band{http://metal-archives.com/band.php?id=8571}{3 Inches of Blood}
  \band{http://www.myspace.com/36crazyfists}{36 Crazyfists}
  \band{http://metal-archives.com/band.php?id=213}{Aborted}
  \band{http://metal-archives.com/band.php?id=52972}{Aborted Fetus}
\end{enumerate}

\end{document}
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

\topsep ajustment in list

Post by svend_tveskaeg »

Again, very nice!

With that said, there is still something bothering me: If I use your suggestion, i.e.,

Code: Select all

\newcommand{\album}[3]{%
  \begin{enumerate}[partopsep=-4pt]%
      \item \fontsize{12pt}{12pt} \selectfont \textsf{\href{#1}{#2}~(#3)}%
      \setcounter{bandoralbum}{1}
  \end{enumerate}%
}
the spacing between the items in the album list is too big and the spaceing between "Tale of Two Cities, A (2008)" and "3 Inches of Blood" is too small, compared to the spacing between "2 0’Clock Girlfriend" and "Tale of Two Cities, A (2008)". (See test1.pdf.) The spacing between "Tale of Two Cities, A (2008)" and "3 Inches of Blood" is fine, though, if I use

Code: Select all

\newcommand{\album}[3]{%
  \begin{enumerate}[partopsep=0pt]%
      \item \fontsize{12pt}{12pt} \selectfont \textsf{\href{#1}{#2}~(#3)}%
      \setcounter{bandoralbum}{1}
  \end{enumerate}%
}
but now the spacing between the items in the album list is even worse (aka. bigger) than before. (See test2.pdf.) How do I eliminate this space without messing with the spacing between "Tale of Two Cities, A (2008)" and "3 Inches of Blood"?

Thanks in advance, once again!
Attachments
test1.pdf
(33.8 KiB) Downloaded 260 times
test2.pdf
(38.2 KiB) Downloaded 232 times
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
magicmoose
Posts: 90
Joined: Fri Nov 06, 2009 7:29 am

Re: \topsep ajustment in list

Post by magicmoose »

I can't really help you any more I'm sorry. To be honest my last post took me some time and a bit of muddling about, I think someone with a bit more experience will have to help you.

Hope you get a solution
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Re: \topsep ajustment in list

Post by svend_tveskaeg »

You have helped alot; thank you very much!

If someone has some constructive to say, regarind this thread, feel free to write!

Thanks in advance!
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
Post Reply