Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
youngjinkim81 opened this issue Jun 7, 2024 · 7 comments
Closed

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

youngjinkim81 opened this issue Jun 7, 2024 · 7 comments

Comments

@youngjinkim81
Copy link

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

@statkclee
Copy link
Contributor

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

@youngjinkim81
Copy link
Author

bitpublish 소제목

위 그림 처럼
##,

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

@choonghyunryu
Copy link
Contributor

choonghyunryu commented Jun 8, 2024

@youngjinkim81,

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

@choonghyunryu
Copy link
Contributor

@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
Copy link
Contributor

@youngjinkim81

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

@youngjinkim81
Copy link
Author

youngjinkim81 commented Jun 8, 2024 via email

@choonghyunryu
Copy link
Contributor

문제해결로 이슈를 닫습니다

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants