1

Here is a MWE:

% Preview source code

%% LyX 2.3.2-2 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[a4paper,english,hebrew,numbers=noenddot]{scrartcl}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{fontspec}
\setlength{\parindent}{0bp}
\usepackage{color}
\usepackage[unicode=true,pdfusetitle,
 bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
 breaklinks=false,pdfborder={0 0 0},pdfborderstyle={},backref=false,colorlinks=true]
 {hyperref}
\hypersetup{
 linkcolor=blue}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\pdfpageheight\paperheight
\pdfpagewidth\paperwidth


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\newfontfamily\hebrewfont[Script=Hebrew]{David CLM}
\newfontfamily\hebrewfonttt[Script=Hebrew]{Miriam Mono CLM}
\newfontfamily\hebrewfontsf[Script=Hebrew]{Bellefair}
\newfontfamily{\am}{Open Sans Hebrew}
\AtBeginDocument{
\renewcommand\footnoterule{%
  \kern -3pt
  \hbox to \textwidth{\hfill\vrule height 0.4pt width .4\textwidth}
  \kern 2.6pt
}}
\renewcommand{\labelenumii}{\labelenumi\arabic{enumii}.}
\addtokomafont{disposition}{\rmfamily}
\renewcommand{\descriptionlabel}[1]{\hspace{\labelsep}\bfseries\am\textcolor{blue}{#1:}}

\makeatother

\usepackage{polyglossia}
\setdefaultlanguage{hebrew}
\setotherlanguage{english}
\begin{document}
\begin{description}
\item [{כחגלדך}] דג סקרן שט לו ביום דג סקרן שט לו ביום דג סקרן שט לו ביום
דג סקרן שט לו ביום דג סקרן שט לו ביום דג סקרן שט לו ביום דג סקרן שט
לו ביום דג סקרן שט לו ביום דג סקרן שט לו ביום דג סקרן שט לו ביום דג
סקרן שט לו ביום דג סקרן שט לו ביום דג סקרן שט לו ביום דג סקרן שט לו
ביום דג סקרן שט לו ביום דג סקרן שט לו
\end{description}

\end{document}

This is the result:
enter image description here

As you can see there text is below the blue word. Can I separate them?
i.e.:
All of the text will be after the black line. Can I do something like this?
enter image description here

In other words - it is possible to make a space for the labels (blue words) and space for the text that they wont mix?

EDIT:
I use this solution to design my description - https://stackoverflow.com/a/7629070/2013542, so there is something that I can add for this that it will work?

Thank you!

  • 1
    Maybe you can achieve the desired result with the enumitem package. You could then use something like \begin{description}[labelwidth =<width of your choice>] – leandriis Jun 15 at 14:42
  • 2
  • Thank you @DavidPurton! But I'm using LyX so I need a solution for this (e.g. something to put at the preamble...) – heblyx Jun 15 at 14:51
  • 1
    If you want a quick solution, a tabularx environment would do the trick. Can LyX use tabularx? – David Purton Jun 15 at 14:54
  • Or how about this one: tex.stackexchange.com/q/130097/87678 – David Purton Jun 15 at 15:01
1

This answer slightly adjusts Gonzalo Medina's answer to a similar problem, so that you only need make changes in the preamble and can continue to use the description environment as normal in LyX.

MWE

\documentclass{article}
\usepackage{xcolor}
\usepackage{polyglossia}
\setdefaultlanguage{hebrew}
\newfontfamily\hebrewfont[Script=Hebrew]{David CLM}

%% variable width label description set up
\usepackage{enumitem}
\usepackage{environ}
\newlength\widest
\renewcommand{\descriptionlabel}[1]{%
  \hspace{\labelsep}%
  \bfseries\textcolor{blue}{#1:}}
\newlist{heblyxdesc}{description}{1}
\makeatletter
\RenewEnviron{description}{%
  \vbox{%
    \global\setlength\widest{0pt}%
    \def\item[##1]{%
      \settowidth\@tempdima{\textbf{##1:}}%
      \ifdim\@tempdima>\widest\global\setlength\widest{\@tempdima}\fi%
    }%
    \setbox0=\hbox{\BODY}%
  }
  \begin{heblyxdesc}[
    leftmargin=\dimexpr\widest+0.5em\relax,
    labelindent=0pt,
    labelwidth=\widest,
    style=unboxed]
  \BODY
  \end{heblyxdesc}%
}
\makeatother

\begin{document}
\begin{description}
  \item[כחגלדך] דג סקרן שט לו ביום דג סקרן שט לו ביום דג סקרן שט לו ביום דג
    סקרן שט לו ביום דג סקרן שט לו ביום דג סקרן שט לו ביום דג סקרן שט לו ביום
  \item[כחגלדך כחגלדך]
    דג סקרן שט לו ביום דג סקרן שט לו ביום דג סקרן שט לו ביום דג סקרן שט לו
    ביום דג סקרן שט לו ביום דג סקרן שט לו ביום דג סקרן שט לו ביום דג סקרן שט
    לו ביום דג סקרן שט לו
\end{description}

\end{document}

MWE output

  • Thank you!! It's Works! But if put a very long word this is what happen: i.imgur.com/NqqZ39r.png (look at the third label). How can I fix this? – heblyx Jun 15 at 19:39
  • @heblyx, I can not reproduce this with my MWE. Even long labels work properly. Check carefully that there are no differences from my code. And if still, then you could ask another question with a MWE. – David Purton Jun 16 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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