bit2r / bitPublish

Quarto extension for a template to publish a PDF book with LaTeX styling.
GNU General Public License v2.0
7 stars 2 forks source link

서식 (소제목) 색상 변경 #62

Open youngjinkim81 opened 3 months ago

youngjinkim81 commented 3 months ago

인쇄를 고려하여 소제목 색상을 변경할 경우 어느 부분을 수정하면 될까요?

statkclee commented 3 months ago

인쇄는 어디를 말씀하시는 건가요? 혹시, 이미지로 공유해주실 수 있나요?

youngjinkim81 commented 3 months ago
bitpublish 소제목

위 그림 처럼

,

으로 표현한 소제목을 의미하는 부분이었습니다. 출판사에서 색상을 변경해주었으면 해서요.

choonghyunryu commented 3 months ago

@youngjinkim81,

소제목이라 함은 9.3과 9.3.1을 의미하나요? 예를 들면 이들의 색상을 짙은 회색으로 표현한다거나요.

choonghyunryu commented 3 months ago

@youngjinkim81

_extension/bit2r/bitPublish/bitPublish.tex 파일을 수정하면 됩니다.

짙은 회색으로 폰트 색상을 변경하기 위해서는 다음과 같이 수정합니다. 주의할 것은 색상을 정의하기 위해서 "컬러정의" 부분을 \usepackage{titlesec} 선언의 앞으로 이동했습니다.

%%==============================================================================
%% 컬러 정의
%%==============================================================================
\definecolor{gray95}{gray}{.95}
\definecolor{gray85}{gray}{.85}
\definecolor{aliceblue}{rgb}{0.94, 0.97, 1.0}
\definecolor{ExerciseColor}{gray}{0.65}              % for example 
\definecolor{problemblue}{RGB}{100, 134, 158}        % for 시각화전략
\definecolor{light}{HTML}{E6E6FA}
\definecolor{highlight}{HTML}{800080}
\definecolor{dark}{HTML}{330033}
\definecolor{cornflowerblue}{rgb}{0.39, 0.58, 0.93}  % for Exercise 
\definecolor{colsec}{HTML}{333333}                   % for Section
\definecolor{colsub}{HTML}{333333}                   % for Subsection 

%%==============================================================================
%% 절(section)과 서브절(subsection) 타이틀을 돋움체(sans-serif)로 바꾸기
%%==============================================================================
%% Rmarkdown과 titlesec 패키지가 호환되지 않는 이슈가 있음. 
%% 아래 두줄의 명령을 입력하지 않으면 에러가 발생함
%% 문제의 원인:
%% https://stackoverflow.com/questions/40439701/cant-knit-to-pdf-with-custom-styles
%% 문제의 해결
%% https://github.com/rstudio/bookdown/issues/677
\let\paragraph\oldparagraph
\let\subparagraph\oldsubparagraph

\usepackage{titlesec}
\titleformat{\section}
  {\color{colsec}\sffamily\selectfont\Large\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}
  {\color{colsub}\sffamily\selectfont\large\bfseries}{\thesubsection}{1em}{}  

위 예제에서 색상을 다음과 같이 RGB로 정의했으나, LaTeX 색상을 사용해도 됩니다.

\definecolor{colsec}{HTML}{333333}                   % for Section
\definecolor{colsub}{HTML}{333333}                   % for Subsection 

그리고 \titleformat{\section} 혹은 \titleformat{\subsection}에서 해당 색상을 가져다 씁니다.

이 예제는 짙은 회색이라 분간하기 어려울 수 있으니 'red'와 같은 색으로 변경해보시면 변경된 타이틀 색상을 쉽게 확인 가능합니다.

\usepackage{titlesec}
\titleformat{\section}
  {\color{colsec}\sffamily\selectfont\Large\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}
  {\color{colsub}\sffamily\selectfont\large\bfseries}{\thesubsection}{1em}{}  

예를 들어,

\usepackage{titlesec}
\titleformat{\section}
  {\color{red}\sffamily\selectfont\Large\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}
  {\color{red}\sffamily\selectfont\large\bfseries}{\thesubsection}{1em}{}  
choonghyunryu commented 3 months ago

@youngjinkim81

version 0.4.2에 해당 기능 반영했습니다. 사용법도 3장. bitPublish 사용 팁에 추가했습니다.

youngjinkim81 commented 3 months ago

넵 감사합니다. 잘 활용하도록 하겠습니다.

On Sat, Jun 8, 2024 at 3:27 PM Choonghyun Ryu @.***> wrote:

@youngjinkim81 https://github.com/youngjinkim81

version 0.4.2에 해당 기능 반영했습니다. 사용법도 3장. bitPublish 사용 팁에 추가했습니다.

— Reply to this email directly, view it on GitHub https://github.com/bit2r/bitPublish/issues/62#issuecomment-2155834894, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE7645GEFFCNKBQAC77YTA3ZGKP3VAVCNFSM6AAAAABI5V7FV2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNJVHAZTIOBZGQ . You are receiving this because you were mentioned.Message ID: @.***>