Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am using this code

\documentclass[paper=a4, paper=portrait, pagesize=auto]{scrartcl}

\usepackage[inline]{enumitem}   
\usepackage[table]{xcolor}
\definecolor{orange}{HTML}{FFC296}
\begin{document} 
\SetLabelAlign{rightbox}{\hss\llap{#1\quad}}
\setlist[description,1]{align=rightbox,labelsep=0pt,leftmargin=0pt}
\section{Student 93b427156c}
\begin{description}
    \item[number] 93b4s27156c              
    \item[name] Note that this analysis of a formative as a pair of sets of features is necessary
to impose an interpretation on an important distinction in language use.
\end{description}
\end{document}

and its giving this output

enter image description here

Is there any way to align all the labels under Student Section not the left side of Section

share|improve this question
1  
Would you please provide an image of the output you're after, since it's not very clear from your description what you mean by "align all the labels under Student Section"? –  Werner May 3 '13 at 5:20

3 Answers 3

The idea is to use your code, and then to use an additional list (with the help of the changepage package), as a wrapper, to get the desired leftmargin. The newly defined environment mdesc needs to know the widest label, to make the necessary calculations; this longest label must be given as a mandatory argument to the environment:

\documentclass[paper=a4, paper=portrait, pagesize=auto]{scrartcl}
\usepackage[inline]{enumitem}   
\usepackage{calc}
\usepackage{changepage}

\setlist[description,1]{labelsep=0pt,leftmargin=0pt}

\newenvironment{mdesc}[1]
{
  \begin{adjustwidth}{\widthof{{\bfseries#1}\quad}}{0pt}
  \begin{description}[before={
    \renewcommand\makelabel[1]{%
      \llap{\makebox[\widthof{\bfseries#1}][l]{\hfill\bfseries####1}\quad}}}]
}
{\end{description}\end{adjustwidth}}

\begin{document} 

\section{Student 93b427156c}

\begin{mdesc}{number}
    \item[number] 93b4s27156c              
    \item[name] Note that this analysis of a formative as a pair of sets of features is necessary
to impose an interpretation on an important distinction in language use.
\end{mdesc}

\end{document}

enter image description here

share|improve this answer

I'm not sure how to directly align the paragraph with the section name. Someone else probably will. Instead, here is a way to mock up a similar layout, using longtable. See what you think.

\documentclass[paper=a4, paper=portrait, pagesize=auto]{scrartcl}

\usepackage{longtable}
\usepackage{xcolor}
\usepackage{booktabs}
\usepackage{graphicx}
\definecolor{orange}{HTML}{FFC296}
\begin{document} 

\begin{longtable}[l]{ l l p{10cm}}
\textbf{{\Large 1}} & \multicolumn{2}{l}{\textbf{{\Large Student 93b4s27156c}}} \\[2ex]
  & \textbf{number} & 93b4s27156c \\[2ex] 
  & \textbf{name} & Note that this analysis of a formative as a pair of sets of features is necessary to impose an interpretation on an important distinction in language use.h \\[2ex] 
\end{longtable}

%\SetLabelAlign{rightbox}{\hss\llap{#1\quad}}
%\setlist[description,1]{align=rightbox,labelsep=0pt,leftmargin=0pt}
\section{Student 93b427156c}
\begin{description}
\item[number] 93b4s27156c              
\item[name] Note that this analysis of a formative as a pair of sets of features is necessary to impose an interpretation on an important distinction in language use.
\end{description}
\end{document}

And this is the result (with what you originally had, below it.):

enter image description here

share|improve this answer

You have the framework already in place- the only thing to change is the section formatting. The titlesec is very helpful here- the only thing I had to add was

% custom section
\titleformat{\section}
{\normalfont\Large\bfseries}
{\llap{\thesection\hskip.5cm}}
{0pt}
{}

Here's the output

screenshot

% arara: pdflatex
% !arara: indent: {overwrite: on}
\documentclass{article}

\usepackage[inline]{enumitem}   
\usepackage{titlesec}

% custom section
\titleformat{\section}
{\normalfont\Large\bfseries}
{\llap{\thesection\hskip.5cm}}
{0pt}
{}

\begin{document} 
\SetLabelAlign{rightbox}{\hss\llap{#1\quad}}
\setlist[description,1]{align=rightbox,labelsep=0pt,leftmargin=0pt}
\section{Student 93b427156c}
\begin{description}
    \item[number] 93b4s27156c              
    \item[name] Note that this analysis of a formative as a pair of sets of features is necessary
    to impose an interpretation on an important distinction in language use.
\end{description}
\end{document}
share|improve this answer
    
i tired that ans its not working for me –  user17 May 3 '13 at 5:55

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.